mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 16:07:01 +08:00
fix rclone bug
This commit is contained in:
@@ -206,8 +206,27 @@ class Rclone(StorageBase):
|
|||||||
startupinfo=self.__get_hidden_shell()
|
startupinfo=self.__get_hidden_shell()
|
||||||
)
|
)
|
||||||
if ret.returncode == 0:
|
if ret.returncode == 0:
|
||||||
items = json.loads(ret.stdout)
|
# 判断是否是文件
|
||||||
return self.__get_rcloneitem(items[0])
|
if str(path.name) in str(ret.stdout.decode('utf-8')):
|
||||||
|
items = json.loads(ret.stdout)
|
||||||
|
return self.__get_rcloneitem(items[0], parent=str(path.parent) + "/")
|
||||||
|
|
||||||
|
ret = subprocess.run(
|
||||||
|
[
|
||||||
|
'rclone', 'lsjson',
|
||||||
|
f'MP:{path.parent}'
|
||||||
|
],
|
||||||
|
capture_output=True,
|
||||||
|
startupinfo=self.__get_hidden_shell()
|
||||||
|
)
|
||||||
|
if ret.returncode == 0:
|
||||||
|
# 判断是否是目录
|
||||||
|
if str(path.name) in str(ret.stdout.decode('utf-8')):
|
||||||
|
items = json.loads(ret.stdout)
|
||||||
|
for item in items:
|
||||||
|
if item.get("Path") == path.name:
|
||||||
|
return self.__get_rcloneitem(item, parent=str(path.parent) + "/")
|
||||||
|
return None
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error(f"rclone获取文件失败:{err}")
|
logger.error(f"rclone获取文件失败:{err}")
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user