mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-07 07:41:28 +08:00
fix downloader task status queries
This commit is contained in:
@@ -28,9 +28,8 @@ from app.log import logger
|
||||
from app.schemas import (
|
||||
RateLimitExceededException,
|
||||
TransferInfo,
|
||||
TransferTorrent,
|
||||
ExistMediaInfo,
|
||||
DownloadingTorrent,
|
||||
DownloaderTorrent,
|
||||
CommingMessage,
|
||||
Notification,
|
||||
WebhookEventInfo,
|
||||
@@ -1221,16 +1220,22 @@ class ChainBase(metaclass=ABCMeta):
|
||||
status: TorrentStatus = None,
|
||||
hashs: Union[list, str] = None,
|
||||
downloader: Optional[str] = None,
|
||||
) -> Optional[List[Union[TransferTorrent, DownloadingTorrent]]]:
|
||||
include_all_tags: bool = False,
|
||||
) -> Optional[List[DownloaderTorrent]]:
|
||||
"""
|
||||
获取下载器种子列表
|
||||
:param status: 种子状态
|
||||
:param hashs: 种子Hash
|
||||
:param downloader: 下载器
|
||||
:param include_all_tags: 是否包含未打内置标签的下载任务
|
||||
:return: 下载器中符合状态的种子列表
|
||||
"""
|
||||
return self.run_module(
|
||||
"list_torrents", status=status, hashs=hashs, downloader=downloader
|
||||
"list_torrents",
|
||||
status=status,
|
||||
hashs=hashs,
|
||||
downloader=downloader,
|
||||
include_all_tags=include_all_tags,
|
||||
)
|
||||
|
||||
def transfer(
|
||||
|
||||
@@ -22,7 +22,7 @@ from app.helper.directory import DirectoryHelper
|
||||
from app.helper.thread import ThreadHelper
|
||||
from app.helper.torrent import TorrentHelper
|
||||
from app.log import logger
|
||||
from app.schemas import ExistMediaInfo, FileURI, NotExistMediaInfo, DownloadingTorrent, Notification, ResourceSelectionEventData, \
|
||||
from app.schemas import ExistMediaInfo, FileURI, NotExistMediaInfo, DownloaderTorrent, Notification, ResourceSelectionEventData, \
|
||||
ResourceDownloadEventData
|
||||
from app.schemas.types import MediaType, TorrentStatus, EventType, MessageChannel, NotificationType, ContentType, \
|
||||
ChainEventType
|
||||
@@ -1359,7 +1359,7 @@ class DownloadChain(ChainBase):
|
||||
link=settings.MP_DOMAIN('#/downloading')
|
||||
))
|
||||
|
||||
def downloading(self, name: Optional[str] = None) -> List[DownloadingTorrent]:
|
||||
def downloading(self, name: Optional[str] = None) -> List[DownloaderTorrent]:
|
||||
"""
|
||||
查询正在下载的任务
|
||||
"""
|
||||
@@ -1417,7 +1417,7 @@ class DownloadChain(ChainBase):
|
||||
return
|
||||
logger.warn(f"检测到下载源文件被删除,删除下载任务(不含文件):{hash_str}")
|
||||
# 先查询种子
|
||||
torrents: List[schemas.TransferTorrent] = self.list_torrents(hashs=[hash_str])
|
||||
torrents: List[schemas.DownloaderTorrent] = self.list_torrents(hashs=[hash_str])
|
||||
if torrents:
|
||||
self.remove_torrents(hashs=[hash_str], delete_file=False)
|
||||
# 发出下载任务删除事件,如需处理辅种,可监听该事件
|
||||
|
||||
Reference in New Issue
Block a user