Merge pull request #96 from thsrite/main

This commit is contained in:
jxxghp
2023-08-12 22:54:46 +08:00
committed by GitHub
9 changed files with 224 additions and 26 deletions

View File

@ -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,6 +308,14 @@ class ChainBase(metaclass=ABCMeta):
"""
return self.run_module("stop_torrents", hashs=hashs)
def torrent_files(self, tid: str) -> Optional[List[File]]:
"""
根据种子文件,选择并添加下载任务
:param tid: 种子Hash
:return: 种子文件
"""
return self.run_module("torrent_files", tid=tid)
def media_exists(self, mediainfo: MediaInfo, itemid: str = None) -> Optional[ExistMediaInfo]:
"""
判断媒体文件是否存在

View File

@ -1,4 +1,5 @@
import re
from msilib.schema import File
from pathlib import Path
from typing import List, Optional, Tuple, Set, Dict, Union
@ -623,3 +624,13 @@ class DownloadChain(ChainBase):
删除下载任务
"""
return self.remove_torrents(hashs=[hash_str])
def get_files(self, tid: str) -> Optional[List[File]]:
"""
获取种子文件清单
"""
try:
return self.torrent_files(tid=tid)
except Exception as err:
logger.error(f"获取种子文件列表出错:{err}")
return None