mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
refactor: normalize downloader file contracts
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
from pathlib import Path
|
||||
from typing import Set, Tuple, Optional, Union, List, Dict
|
||||
|
||||
from qbittorrentapi import TorrentFilesList
|
||||
|
||||
from app.schemas.dashboard import DownloaderInfo as _SchemaDownloaderInfo
|
||||
from app.domain.metainfo import MetaInfo
|
||||
from app.runtime.log import logger
|
||||
from app.runtime.settings import RuntimeSettingsCompat
|
||||
from app.modules._base import _DownloaderModuleBase
|
||||
from app.modules.qbittorrent.qbittorrent import Qbittorrent
|
||||
from app.schemas.transfer import DownloaderTorrent
|
||||
from app.schemas.transfer import DownloaderFile, DownloaderTorrent
|
||||
from app.schemas.types import (
|
||||
DownloadTaskState,
|
||||
DownloaderType,
|
||||
@@ -515,14 +513,18 @@ class QbittorrentModule(_DownloaderModuleBase[Qbittorrent]):
|
||||
return None
|
||||
return server.stop_torrents(ids=hashs)
|
||||
|
||||
def torrent_files(self, tid: str, downloader: Optional[str] = None) -> Optional[TorrentFilesList]:
|
||||
def torrent_files(
|
||||
self, tid: str, downloader: Optional[str] = None
|
||||
) -> Optional[List[DownloaderFile]]:
|
||||
"""
|
||||
获取种子文件列表
|
||||
获取种子文件列表,并在模块边界隔离 qBittorrent SDK 集合类型。
|
||||
"""
|
||||
server: Qbittorrent = self.get_instance(downloader)
|
||||
if not server:
|
||||
return None
|
||||
return server.get_files(tid=tid)
|
||||
return self._normalize_torrent_files(
|
||||
server.get_files(tid=tid), DownloaderFile.model_validate
|
||||
)
|
||||
|
||||
def downloader_info(self, downloader: Optional[str] = None) -> Optional[List[_SchemaDownloaderInfo]]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user