fix
This commit is contained in:
@ -35,7 +35,7 @@ class _ModuleBase(metaclass=ABCMeta):
|
||||
识别前的预处理
|
||||
:param title: 标题
|
||||
:param subtitle: 副标题
|
||||
:return: 处理后的标题、副标题,注意如果返回None,有可能是没有对应的处理模块,应无视结果
|
||||
:return: 处理后的标题、副标题,该方法可被多个模块同时处理
|
||||
"""
|
||||
pass
|
||||
|
||||
@ -51,6 +51,14 @@ class _ModuleBase(metaclass=ABCMeta):
|
||||
"""
|
||||
pass
|
||||
|
||||
def obtain_image(self, mediainfo: MediaInfo) -> Optional[MediaInfo]:
|
||||
"""
|
||||
获取图片
|
||||
:param mediainfo: 识别的媒体信息
|
||||
:return: 更新后的媒体信息,该方法可被多个模块同时处理
|
||||
"""
|
||||
pass
|
||||
|
||||
def douban_info(self, doubanid: str) -> Optional[dict]:
|
||||
"""
|
||||
获取豆瓣信息
|
||||
@ -82,14 +90,6 @@ class _ModuleBase(metaclass=ABCMeta):
|
||||
"""
|
||||
pass
|
||||
|
||||
def obtain_image(self, mediainfo: MediaInfo) -> Optional[MediaInfo]:
|
||||
"""
|
||||
获取图片
|
||||
:param mediainfo: 识别的媒体信息
|
||||
:return: 更新后的媒体信息,该方法可被多个模块同时处理
|
||||
"""
|
||||
pass
|
||||
|
||||
def search_medias(self, meta: MetaBase) -> Optional[List[MediaInfo]]:
|
||||
"""
|
||||
搜索媒体信息
|
||||
@ -98,6 +98,14 @@ class _ModuleBase(metaclass=ABCMeta):
|
||||
"""
|
||||
pass
|
||||
|
||||
def media_exists(self, mediainfo: MediaInfo) -> Optional[dict]:
|
||||
"""
|
||||
判断媒体文件是否存在
|
||||
:param mediainfo: 识别的媒体信息
|
||||
:return: 如不存在返回None,存在时返回信息,包括每季已存在所有集{type: movie/tv, seasons: {season: [episodes]}}
|
||||
"""
|
||||
pass
|
||||
|
||||
def search_torrents(self, mediainfo: Optional[MediaInfo], sites: List[CommentedMap],
|
||||
keyword: str = None) -> Optional[List[TorrentInfo]]:
|
||||
"""
|
||||
@ -138,6 +146,15 @@ class _ModuleBase(metaclass=ABCMeta):
|
||||
"""
|
||||
pass
|
||||
|
||||
def download_added(self, context: Context, torrent_path: Path) -> None:
|
||||
"""
|
||||
添加下载任务后的处理
|
||||
:param context: 上下文,包括识别信息、媒体信息、种子信息
|
||||
:param torrent_path: 种子文件地址
|
||||
:return: None,该方法可被多个模块同时处理
|
||||
"""
|
||||
pass
|
||||
|
||||
def list_torrents(self, status: TorrentStatus = None,
|
||||
hashs: Union[list, str] = None) -> Optional[List[dict]]:
|
||||
"""
|
||||
@ -166,11 +183,11 @@ class _ModuleBase(metaclass=ABCMeta):
|
||||
"""
|
||||
pass
|
||||
|
||||
def media_exists(self, mediainfo: MediaInfo) -> Optional[dict]:
|
||||
def remove_torrents(self, hashs: Union[str, list]) -> bool:
|
||||
"""
|
||||
判断媒体文件是否存在
|
||||
:param mediainfo: 识别的媒体信息
|
||||
:return: 如不存在返回None,存在时返回信息,包括每季已存在所有集{type: movie/tv, seasons: {season: [episodes]}}
|
||||
删除下载器种子
|
||||
:param hashs: 种子Hash
|
||||
:return: bool
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -139,5 +139,14 @@ class QbittorrentModule(_ModuleBase):
|
||||
self.qbittorrent.set_torrents_tag(ids=hashs, tags=['已整理'])
|
||||
# 移动模式删除种子
|
||||
if settings.TRANSFER_TYPE == "move":
|
||||
if self.qbittorrent.delete_torrents(delete_file=True, ids=hashs):
|
||||
if self.remove_torrents(hashs):
|
||||
logger.info(f"移动模式删除种子成功:{hashs} ")
|
||||
|
||||
def remove_torrents(self, hashs: Union[str, list]) -> bool:
|
||||
"""
|
||||
删除下载器种子
|
||||
:param hashs: 种子Hash
|
||||
:return: bool
|
||||
"""
|
||||
return self.qbittorrent.delete_torrents(delete_file=True, ids=hashs)
|
||||
|
||||
|
30
app/modules/subtitle/__init__.py
Normal file
30
app/modules/subtitle/__init__.py
Normal file
@ -0,0 +1,30 @@
|
||||
from pathlib import Path
|
||||
from typing import Tuple, Union
|
||||
|
||||
from app.core.context import Context
|
||||
from app.modules import _ModuleBase
|
||||
|
||||
|
||||
class SubtitleModule(_ModuleBase):
|
||||
"""
|
||||
字幕下载模块
|
||||
"""
|
||||
|
||||
def init_module(self) -> None:
|
||||
pass
|
||||
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
pass
|
||||
|
||||
def stop(self) -> None:
|
||||
pass
|
||||
|
||||
def download_added(self, context: Context, torrent_path: Path) -> None:
|
||||
"""
|
||||
添加下载任务成功后,从站点下载字幕
|
||||
:param context: 上下文,包括识别信息、媒体信息、种子信息
|
||||
:param torrent_path: 种子文件地址
|
||||
:return: None,该方法可被多个模块同时处理
|
||||
"""
|
||||
pass
|
||||
|
@ -122,5 +122,13 @@ class TransmissionModule(_ModuleBase):
|
||||
self.transmission.set_torrent_tag(ids=hashs, tags=['已整理'])
|
||||
# 移动模式删除种子
|
||||
if settings.TRANSFER_TYPE == "move":
|
||||
if self.transmission.delete_torrents(delete_file=True, ids=hashs):
|
||||
if self.remove_torrents(hashs):
|
||||
logger.info(f"移动模式删除种子成功:{hashs} ")
|
||||
|
||||
def remove_torrents(self, hashs: Union[str, list]) -> bool:
|
||||
"""
|
||||
删除下载器种子
|
||||
:param hashs: 种子Hash
|
||||
:return: bool
|
||||
"""
|
||||
return self.transmission.delete_torrents(delete_file=True, ids=hashs)
|
||||
|
30
app/modules/words/__init__.py
Normal file
30
app/modules/words/__init__.py
Normal file
@ -0,0 +1,30 @@
|
||||
from pathlib import Path
|
||||
from typing import Tuple, Union
|
||||
|
||||
from app.core.context import Context
|
||||
from app.modules import _ModuleBase
|
||||
|
||||
|
||||
class WordseModule(_ModuleBase):
|
||||
"""
|
||||
字幕下载模块
|
||||
"""
|
||||
|
||||
def init_module(self) -> None:
|
||||
pass
|
||||
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
pass
|
||||
|
||||
def stop(self) -> None:
|
||||
pass
|
||||
|
||||
def prepare_recognize(self, title: str,
|
||||
subtitle: str = None) -> Tuple[str, str]:
|
||||
"""
|
||||
处理各类特别命名,以便识别
|
||||
:param title: 标题
|
||||
:param subtitle: 副标题
|
||||
:return: 处理后的标题、副标题,该方法可被多个模块同时处理
|
||||
"""
|
||||
pass
|
Reference in New Issue
Block a user