mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-04-13 11:19:44 +08:00
fix rclone bug
This commit is contained in:
@@ -206,8 +206,27 @@ class Rclone(StorageBase):
|
||||
startupinfo=self.__get_hidden_shell()
|
||||
)
|
||||
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:
|
||||
logger.error(f"rclone获取文件失败:{err}")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user