fix torrent_files
This commit is contained in:
@ -2,6 +2,7 @@ import gc
|
|||||||
import pickle
|
import pickle
|
||||||
import traceback
|
import traceback
|
||||||
from abc import ABCMeta
|
from abc import ABCMeta
|
||||||
|
from msilib.schema import File
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, Any, Tuple, List, Set, Union, Dict
|
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)
|
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
|
:param tid: 种子Hash
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import re
|
import re
|
||||||
|
from msilib.schema import File
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional, Tuple, Set, Dict, Union
|
from typing import List, Optional, Tuple, Set, Dict, Union
|
||||||
|
|
||||||
from qbittorrentapi import TorrentFilesList
|
|
||||||
|
|
||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.context import MediaInfo, TorrentInfo, Context
|
from app.core.context import MediaInfo, TorrentInfo, Context
|
||||||
@ -626,7 +625,7 @@ class DownloadChain(ChainBase):
|
|||||||
"""
|
"""
|
||||||
return self.remove_torrents(hashs=[hash_str])
|
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 pathlib import Path
|
||||||
from typing import Set, Tuple, Optional, Union, List
|
from typing import Set, Tuple, Optional, Union, List
|
||||||
|
|
||||||
@ -187,6 +188,12 @@ class QbittorrentModule(_ModuleBase):
|
|||||||
"""
|
"""
|
||||||
return self.qbittorrent.start_torrents(ids=hashs)
|
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:
|
def downloader_info(self) -> schemas.DownloaderInfo:
|
||||||
"""
|
"""
|
||||||
下载器信息
|
下载器信息
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import time
|
import time
|
||||||
|
from msilib.schema import File
|
||||||
from typing import Optional, Union, Tuple, List
|
from typing import Optional, Union, Tuple, List
|
||||||
|
|
||||||
import qbittorrentapi
|
import qbittorrentapi
|
||||||
from qbittorrentapi import TorrentFilesList, TorrentDictionary
|
from qbittorrentapi import TorrentDictionary
|
||||||
from qbittorrentapi.client import Client
|
from qbittorrentapi.client import Client
|
||||||
from qbittorrentapi.transfer import TransferInfoDictionary
|
from qbittorrentapi.transfer import TransferInfoDictionary
|
||||||
|
|
||||||
@ -265,7 +266,7 @@ class Qbittorrent(metaclass=Singleton):
|
|||||||
logger.error(f"删除种子出错:{err}")
|
logger.error(f"删除种子出错:{err}")
|
||||||
return False
|
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 pathlib import Path
|
||||||
from typing import Set, Tuple, Optional, Union, List
|
from typing import Set, Tuple, Optional, Union, List
|
||||||
|
|
||||||
@ -171,6 +172,12 @@ class TransmissionModule(_ModuleBase):
|
|||||||
"""
|
"""
|
||||||
return self.transmission.start_torrents(ids=hashs)
|
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:
|
def downloader_info(self) -> schemas.DownloaderInfo:
|
||||||
"""
|
"""
|
||||||
下载器信息
|
下载器信息
|
||||||
|
@ -192,7 +192,7 @@ class Transmission(metaclass=Singleton):
|
|||||||
logger.error(f"删除种子出错:{err}")
|
logger.error(f"删除种子出错:{err}")
|
||||||
return False
|
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