♻️ 优化插件函数错误/失败返回值
Some checks are pending
Docker Publish / build-and-push (push) Waiting to run

- 提高代码一致性和可读性,避免返回错误类型
This commit is contained in:
Cp0204 2024-11-27 20:21:38 +08:00
parent a56565e187
commit 60cb9ba152
5 changed files with 10 additions and 11 deletions

View File

@ -110,7 +110,7 @@ class Alist:
print(f"Alist刷新: 存储{storage_id}连接失败❌ {data.get('message')}")
except requests.exceptions.RequestException as e:
print(f"Alist刷新: 获取Alist存储出错 {e}")
return False
return []
def refresh(self, path):
data = self.get_file_list(path, True)
@ -146,7 +146,7 @@ class Alist:
return response.json()
except Exception as e:
print(f"📁 Alist刷新: 获取文件列表出错❌ {e}")
return False
return {}
def get_root_folder_full_path(self, cookie, pdir_fid):
if pdir_fid == "0":
@ -179,4 +179,4 @@ class Alist:
return "/".join(file_names)
except requests.exceptions.RequestException as e:
print(f"Alist刷新: 获取Quark路径出错 {e}")
return False
return ""

View File

@ -61,8 +61,8 @@ class Alist_strm:
try:
selected_configs = [int(x.strip()) for x in selected_configs_str.split(",")]
except ValueError:
print("Error: 运行alist-strm配置错误id应以,分割")
return None
print("🔗 alist-strm配置运行: 出错❌ id应以,分割")
return False
data = [("selected_configs", config_id) for config_id in selected_configs]
data.append(("action", "run_selected"))
try:

View File

@ -76,7 +76,7 @@ class Aria2:
return response.json()
except requests.exceptions.RequestException as e:
print(f"Aria2下载: 错误{e}")
return None
return {}
def get_version(self):
"""检查与 Aria2 的连接."""
@ -91,4 +91,4 @@ class Aria2:
def add_uri(self, params=None):
"""添加 URI 下载任务."""
response = self._make_rpc_request("aria2.addUri", params)
return response.get("result") if response else None
return response.get("result") if response else {}

View File

@ -84,7 +84,7 @@ class Emby:
def search(self, media_name):
if not media_name:
return False
return ""
url = f"{self.url}/emby/Items"
headers = {"X-Emby-Token": self.token}
querystring = {
@ -113,4 +113,4 @@ class Emby:
print(f"🎞️ 搜索Emby媒体库{response.text}")
except requests.exceptions.RequestException as e:
print(f"搜索Emby媒体库出错: {e}")
return False
return ""

View File

@ -90,7 +90,6 @@ class Plex:
return libraries
else:
print(f"🎞️ 获取Plex媒体库信息失败❌ 状态码:{response.status_code}")
return None
except Exception as e:
print(f"获取Plex媒体库信息出错: {e}")
return None
return []