fix Rclone存储容量检测问题

This commit is contained in:
jxxghp
2024-11-12 10:10:37 +08:00
parent f1f379966a
commit f9d62e7451
+14 -1
View File
@@ -331,11 +331,24 @@ class Rclone(StorageBase):
""" """
存储使用情况 存储使用情况
""" """
conf = self.get_config()
if not conf:
return None
file_path = conf.config.get("filepath")
if not file_path or not Path(file_path).exists():
return None
# 读取rclone文件,检查是否有[MP]节点配置
with open(file_path, "r", encoding="utf-8") as f:
lines = f.readlines()
if not lines:
return None
if not any("[MP]" in line.strip() for line in lines):
return None
try: try:
ret = subprocess.run( ret = subprocess.run(
[ [
'rclone', 'about', 'rclone', 'about',
'/', '--json' 'MP:/', '--json'
], ],
capture_output=True, capture_output=True,
startupinfo=self.__get_hidden_shell() startupinfo=self.__get_hidden_shell()