🐛 修复获取挂载路径失败的错误处理

- 在获取文件列表时添加错误检查
- 如果获取失败,打印错误信息以便调试
This commit is contained in:
Cp0204 2024-11-27 19:07:06 +08:00
parent 0a47d48c60
commit 925144ea79
2 changed files with 6 additions and 2 deletions

View File

@ -67,7 +67,9 @@ class Alist:
if match := re.match(r"^(\/[^:]*):(\/[^:]*)$", storage_id): if match := re.match(r"^(\/[^:]*):(\/[^:]*)$", storage_id):
# 存储挂载路径, 夸克根文件夹 # 存储挂载路径, 夸克根文件夹
storage_mount_path, quark_root_dir = match.group(1), match.group(2) storage_mount_path, quark_root_dir = match.group(1), match.group(2)
if not self.get_file_list(storage_mount_path): file_list = self.get_file_list(storage_mount_path)
if file_list.get("code") != 200:
print(f"Alist刷新: 获取挂载路径失败❌ {file_list.get('message')}")
return False, (None, None) return False, (None, None)
# 2. 检查是否数字,调用 Alist API 获取存储信息 # 2. 检查是否数字,调用 Alist API 获取存储信息
elif re.match(r"^\d+$", storage_id): elif re.match(r"^\d+$", storage_id):

View File

@ -80,7 +80,9 @@ class Alist_strm_gen:
if match := re.match(r"^(\/[^:]*):(\/[^:]*)$", storage_id): if match := re.match(r"^(\/[^:]*):(\/[^:]*)$", storage_id):
# 存储挂载路径, 夸克根文件夹 # 存储挂载路径, 夸克根文件夹
storage_mount_path, quark_root_dir = match.group(1), match.group(2) storage_mount_path, quark_root_dir = match.group(1), match.group(2)
if not self.get_file_list(storage_mount_path): file_list = self.get_file_list(storage_mount_path)
if file_list.get("code") != 200:
print(f"Alist-Strm生成: 获取挂载路径失败❌ {file_list.get('message')}")
return False, (None, None) return False, (None, None)
# 2. 检查是否数字,调用 Alist API 获取存储信息 # 2. 检查是否数字,调用 Alist API 获取存储信息
elif re.match(r"^\d+$", storage_id): elif re.match(r"^\d+$", storage_id):