mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-05-16 13:55:28 +08:00
feat:actions增加识别选项
This commit is contained in:
@@ -17,6 +17,7 @@ class AddDownloadParams(ActionParams):
|
||||
"""
|
||||
downloader: Optional[str] = Field(None, description="下载器")
|
||||
save_path: Optional[str] = Field(None, description="保存路径")
|
||||
labels: Optional[str] = Field(None, description="标签(,分隔)")
|
||||
only_lack: Optional[bool] = Field(False, description="仅下载缺失的资源")
|
||||
|
||||
|
||||
@@ -92,7 +93,8 @@ class AddDownloadAction(BaseAction):
|
||||
|
||||
did = self.downloadchain.download_single(context=t,
|
||||
downloader=params.downloader,
|
||||
save_path=params.save_path)
|
||||
save_path=params.save_path,
|
||||
label=params.labels)
|
||||
if did:
|
||||
self._added_downloads.append(did)
|
||||
else:
|
||||
|
||||
@@ -21,6 +21,7 @@ class FetchRssParams(ActionParams):
|
||||
content_type: Optional[str] = Field(None, description="Content-Type")
|
||||
referer: Optional[str] = Field(None, description="Referer")
|
||||
ua: Optional[str] = Field(None, description="User-Agent")
|
||||
match_media: Optional[str] = Field(None, description="匹配媒体信息")
|
||||
|
||||
|
||||
class FetchRssAction(BaseAction):
|
||||
@@ -98,10 +99,12 @@ class FetchRssAction(BaseAction):
|
||||
pubdate=item["pubdate"].strftime("%Y-%m-%d %H:%M:%S") if item.get("pubdate") else None,
|
||||
)
|
||||
meta = MetaInfo(title=torrentinfo.title, subtitle=torrentinfo.description)
|
||||
mediainfo = self.chain.recognize_media(meta)
|
||||
if not mediainfo:
|
||||
logger.warning(f"{torrentinfo.title} 未识别到媒体信息")
|
||||
continue
|
||||
mediainfo = None
|
||||
if params.match_media:
|
||||
mediainfo = self.chain.recognize_media(meta)
|
||||
if not mediainfo:
|
||||
logger.warning(f"{torrentinfo.title} 未识别到媒体信息")
|
||||
continue
|
||||
self._rss_torrents.append(Context(meta_info=meta, media_info=mediainfo, torrent_info=torrentinfo))
|
||||
|
||||
if self._rss_torrents:
|
||||
|
||||
@@ -21,6 +21,7 @@ class FetchTorrentsParams(ActionParams):
|
||||
type: Optional[str] = Field(None, description="资源类型 (电影/电视剧)")
|
||||
season: Optional[int] = Field(None, description="季度")
|
||||
sites: Optional[List[int]] = Field([], description="站点列表")
|
||||
match_media: Optional[bool] = Field(False, description="匹配媒体信息")
|
||||
|
||||
|
||||
class FetchTorrentsAction(BaseAction):
|
||||
@@ -71,10 +72,11 @@ class FetchTorrentsAction(BaseAction):
|
||||
if params.season and torrent.meta_info.begin_season != params.season:
|
||||
continue
|
||||
# 识别媒体信息
|
||||
torrent.media_info = self.searchchain.recognize_media(torrent.meta_info)
|
||||
if not torrent.media_info:
|
||||
logger.warning(f"{torrent.torrent_info.title} 未识别到媒体信息")
|
||||
continue
|
||||
if params.match_media:
|
||||
torrent.media_info = self.searchchain.recognize_media(torrent.meta_info)
|
||||
if not torrent.media_info:
|
||||
logger.warning(f"{torrent.torrent_info.title} 未识别到媒体信息")
|
||||
continue
|
||||
self._torrents.append(torrent)
|
||||
else:
|
||||
# 搜索媒体列表
|
||||
|
||||
Reference in New Issue
Block a user