️ 优化Alist和Emby模块错误处理逻辑

This commit is contained in:
Cp0204 2024-11-14 02:13:30 +08:00
parent 0faf3ec569
commit bdc9068f3d
2 changed files with 5 additions and 10 deletions

View File

@ -39,10 +39,9 @@ class Alist:
return True
else:
print(f"Alist: 连接失败❌ {response.get('message')}")
return False
except requests.exceptions.RequestException as e:
print(f"获取Alist信息出错: {e}")
return False
return False
def refresh(self, path, force_refresh=True):
url = f"{self.url}/api/fs/list"
@ -74,10 +73,9 @@ class Alist:
return self.refresh(parent_path)
else:
print(f"📁 刷新Alist目录失败❌ {response.get('message')}")
return False
except requests.exceptions.RequestException as e:
print(f"刷新Alist目录出错: {e}")
return False
return False
def _normalize_path(self, path):
"""标准化路径格式"""

View File

@ -42,10 +42,9 @@ class Emby:
return True
else:
print(f"Emby媒体库: 连接失败❌ {response.text}")
return False
except requests.exceptions.RequestException as e:
print(f"获取Emby媒体库信息出错: {e}")
return False
return False
def refresh(self, emby_id):
if not emby_id:
@ -68,10 +67,9 @@ class Emby:
return True
else:
print(f"🎞️ 刷新Emby媒体库{response.text}")
return False
except requests.exceptions.RequestException as e:
print(f"刷新Emby媒体库出错: {e}")
return False
return False
def search(self, media_name):
if not media_name:
@ -102,7 +100,6 @@ class Emby:
return item["Id"]
else:
print(f"🎞️ 搜索Emby媒体库{response.text}")
return False
except requests.exceptions.RequestException as e:
print(f"搜索Emby媒体库出错: {e}")
return False
return False