mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-28 19:47:41 +08:00
feat: add subtitle search functionality and related data handling
This commit is contained in:
+35
-1
@@ -14,7 +14,7 @@ from transmission_rpc import File
|
||||
|
||||
from app.core.cache import FileCache, AsyncFileCache, fresh, async_fresh
|
||||
from app.core.config import settings
|
||||
from app.core.context import Context, MediaInfo, TorrentInfo
|
||||
from app.core.context import Context, MediaInfo, SubtitleInfo, TorrentInfo
|
||||
from app.core.event import EventManager
|
||||
from app.core.meta import MetaBase
|
||||
from app.core.module import ModuleManager
|
||||
@@ -1053,6 +1053,23 @@ class ChainBase(metaclass=ABCMeta):
|
||||
"search_torrents", site=site, keyword=keyword, mtype=mtype, page=page
|
||||
)
|
||||
|
||||
def search_subtitles(
|
||||
self,
|
||||
site: dict,
|
||||
keyword: str,
|
||||
page: Optional[int] = 0,
|
||||
) -> List[SubtitleInfo]:
|
||||
"""
|
||||
搜索一个站点的字幕资源。
|
||||
:param site: 站点
|
||||
:param keyword: 搜索关键词
|
||||
:param page: 页码
|
||||
:return: 字幕列表
|
||||
"""
|
||||
return self.run_module(
|
||||
"search_subtitles", site=site, keyword=keyword, page=page
|
||||
)
|
||||
|
||||
async def async_search_torrents(
|
||||
self,
|
||||
site: dict,
|
||||
@@ -1072,6 +1089,23 @@ class ChainBase(metaclass=ABCMeta):
|
||||
"async_search_torrents", site=site, keyword=keyword, mtype=mtype, page=page
|
||||
)
|
||||
|
||||
async def async_search_subtitles(
|
||||
self,
|
||||
site: dict,
|
||||
keyword: str,
|
||||
page: Optional[int] = 0,
|
||||
) -> List[SubtitleInfo]:
|
||||
"""
|
||||
异步搜索一个站点的字幕资源。
|
||||
:param site: 站点
|
||||
:param keyword: 搜索关键词
|
||||
:param page: 页码
|
||||
:return: 字幕列表
|
||||
"""
|
||||
return await self.async_run_module(
|
||||
"async_search_subtitles", site=site, keyword=keyword, page=page
|
||||
)
|
||||
|
||||
def refresh_torrents(
|
||||
self,
|
||||
site: dict,
|
||||
|
||||
Reference in New Issue
Block a user