mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-28 11:37:23 +08:00
Fix: Ensure list_torrents and downloading return empty lists
Co-authored-by: jxxghp <jxxghp@qq.com>
This commit is contained in:
@@ -60,7 +60,7 @@ class QueryDownloadTasksTool(MoviePilotTool):
|
|||||||
|
|
||||||
# 如果提供了hash,直接查询该hash的任务(不限制状态)
|
# 如果提供了hash,直接查询该hash的任务(不限制状态)
|
||||||
if hash:
|
if hash:
|
||||||
torrents = download_chain.list_torrents(downloader=downloader, hashs=[hash])
|
torrents = download_chain.list_torrents(downloader=downloader, hashs=[hash]) or []
|
||||||
if not torrents:
|
if not torrents:
|
||||||
return f"未找到hash为 {hash} 的下载任务(该任务可能已完成、已删除或不存在)"
|
return f"未找到hash为 {hash} 的下载任务(该任务可能已完成、已删除或不存在)"
|
||||||
# 转换为DownloadingTorrent格式
|
# 转换为DownloadingTorrent格式
|
||||||
@@ -110,7 +110,7 @@ class QueryDownloadTasksTool(MoviePilotTool):
|
|||||||
# 根据status决定查询方式
|
# 根据status决定查询方式
|
||||||
if status == "downloading":
|
if status == "downloading":
|
||||||
# 如果status为下载中,使用downloading方法
|
# 如果status为下载中,使用downloading方法
|
||||||
downloads = download_chain.downloading(name=downloader)
|
downloads = download_chain.downloading(name=downloader) or []
|
||||||
filtered_downloads = []
|
filtered_downloads = []
|
||||||
for dl in downloads:
|
for dl in downloads:
|
||||||
if downloader and dl.downloader != downloader:
|
if downloader and dl.downloader != downloader:
|
||||||
|
|||||||
Reference in New Issue
Block a user