fix torrent_files
This commit is contained in:
@ -2,6 +2,7 @@ import gc
|
||||
import pickle
|
||||
import traceback
|
||||
from abc import ABCMeta
|
||||
from msilib.schema import File
|
||||
from pathlib import Path
|
||||
from typing import Optional, Any, Tuple, List, Set, Union, Dict
|
||||
|
||||
@ -307,7 +308,7 @@ class ChainBase(metaclass=ABCMeta):
|
||||
"""
|
||||
return self.run_module("stop_torrents", hashs=hashs)
|
||||
|
||||
def torrent_files(self, tid: str) -> Optional[Tuple[Optional[str], str]]:
|
||||
def torrent_files(self, tid: str) -> Optional[List[File]]:
|
||||
"""
|
||||
根据种子文件,选择并添加下载任务
|
||||
:param tid: 种子Hash
|
||||
|
@ -1,9 +1,8 @@
|
||||
import re
|
||||
from msilib.schema import File
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Tuple, Set, Dict, Union
|
||||
|
||||
from qbittorrentapi import TorrentFilesList
|
||||
|
||||
from app.chain import ChainBase
|
||||
from app.core.config import settings
|
||||
from app.core.context import MediaInfo, TorrentInfo, Context
|
||||
@ -626,7 +625,7 @@ class DownloadChain(ChainBase):
|
||||
"""
|
||||
return self.remove_torrents(hashs=[hash_str])
|
||||
|
||||
def get_files(self, tid: str) -> Optional[TorrentFilesList]:
|
||||
def get_files(self, tid: str) -> Optional[List[File]]:
|
||||
"""
|
||||
获取种子文件清单
|
||||
"""
|
||||
|
@ -1,3 +1,4 @@
|
||||
from msilib.schema import File
|
||||
from pathlib import Path
|
||||
from typing import Set, Tuple, Optional, Union, List
|
||||
|
||||
@ -187,6 +188,12 @@ class QbittorrentModule(_ModuleBase):
|
||||
"""
|
||||
return self.qbittorrent.start_torrents(ids=hashs)
|
||||
|
||||
def torrent_files(self, tid: str) -> Optional[List[File]]:
|
||||
"""
|
||||
获取种子文件列表
|
||||
"""
|
||||
return self.qbittorrent.get_files(tid=tid)
|
||||
|
||||
def downloader_info(self) -> schemas.DownloaderInfo:
|
||||
"""
|
||||
下载器信息
|
||||
|
@ -1,8 +1,9 @@
|
||||
import time
|
||||
from msilib.schema import File
|
||||
from typing import Optional, Union, Tuple, List
|
||||
|
||||
import qbittorrentapi
|
||||
from qbittorrentapi import TorrentFilesList, TorrentDictionary
|
||||
from qbittorrentapi import TorrentDictionary
|
||||
from qbittorrentapi.client import Client
|
||||
from qbittorrentapi.transfer import TransferInfoDictionary
|
||||
|
||||
@ -265,7 +266,7 @@ class Qbittorrent(metaclass=Singleton):
|
||||
logger.error(f"删除种子出错:{err}")
|
||||
return False
|
||||
|
||||
def torrent_files(self, tid: str) -> Optional[TorrentFilesList]:
|
||||
def get_files(self, tid: str) -> Optional[List[File]]:
|
||||
"""
|
||||
获取种子文件清单
|
||||
"""
|
||||
|
@ -1,3 +1,4 @@
|
||||
from msilib.schema import File
|
||||
from pathlib import Path
|
||||
from typing import Set, Tuple, Optional, Union, List
|
||||
|
||||
@ -171,6 +172,12 @@ class TransmissionModule(_ModuleBase):
|
||||
"""
|
||||
return self.transmission.start_torrents(ids=hashs)
|
||||
|
||||
def torrent_files(self, tid: str) -> Optional[List[File]]:
|
||||
"""
|
||||
获取种子文件列表
|
||||
"""
|
||||
return self.transmission.get_files(tid=tid)
|
||||
|
||||
def downloader_info(self) -> schemas.DownloaderInfo:
|
||||
"""
|
||||
下载器信息
|
||||
|
@ -192,7 +192,7 @@ class Transmission(metaclass=Singleton):
|
||||
logger.error(f"删除种子出错:{err}")
|
||||
return False
|
||||
|
||||
def torrent_files(self, tid: str) -> Optional[List[File]]:
|
||||
def get_files(self, tid: str) -> Optional[List[File]]:
|
||||
"""
|
||||
获取种子文件列表
|
||||
"""
|
||||
|
Reference in New Issue
Block a user