Merge pull request #2958 from thsrite/v2

This commit is contained in:
jxxghp
2024-10-28 11:38:17 +08:00
committed by GitHub
2 changed files with 12 additions and 3 deletions
+8 -1
View File
@@ -105,7 +105,8 @@ class SearchChain(ChainBase):
sites: List[int] = None, sites: List[int] = None,
rule_groups: List[str] = None, rule_groups: List[str] = None,
area: str = "title", area: str = "title",
custom_words: List[str] = None) -> List[Context]: custom_words: List[str] = None,
filter_params: Dict[str, str] = None) -> List[Context]:
""" """
根据媒体信息搜索种子资源,精确匹配,应用过滤规则,同时根据no_exists过滤本地已存在的资源 根据媒体信息搜索种子资源,精确匹配,应用过滤规则,同时根据no_exists过滤本地已存在的资源
:param mediainfo: 媒体信息 :param mediainfo: 媒体信息
@@ -231,6 +232,12 @@ class SearchChain(ChainBase):
logger.info(f'{mediainfo.title} 通过IMDBID匹配到资源:{torrent.site_name} - {torrent.title}') logger.info(f'{mediainfo.title} 通过IMDBID匹配到资源:{torrent.site_name} - {torrent.title}')
_match_torrents.append((torrent, torrent_meta)) _match_torrents.append((torrent, torrent_meta))
continue continue
# 匹配订阅附加参数
if filter_params and not self.torrenthelper.filter_torrent(torrent_info=torrent,
filter_params=filter_params):
continue
# 比对种子 # 比对种子
if self.torrenthelper.match_torrent(mediainfo=mediainfo, if self.torrenthelper.match_torrent(mediainfo=mediainfo,
torrent_meta=torrent_meta, torrent_meta=torrent_meta,
+4 -2
View File
@@ -348,7 +348,8 @@ class SubscribeChain(ChainBase):
sites=sites, sites=sites,
rule_groups=rule_groups, rule_groups=rule_groups,
area="imdbid" if subscribe.search_imdbid else "title", area="imdbid" if subscribe.search_imdbid else "title",
custom_words=custom_word_list) custom_words=custom_word_list,
filter_params=self.get_params(subscribe))
if not contexts: if not contexts:
logger.warn(f'订阅 {subscribe.keyword or subscribe.name} 未搜索到资源') logger.warn(f'订阅 {subscribe.keyword or subscribe.name} 未搜索到资源')
self.finish_subscribe_or_not(subscribe=subscribe, meta=meta, self.finish_subscribe_or_not(subscribe=subscribe, meta=meta,
@@ -637,7 +638,8 @@ class SubscribeChain(ChainBase):
_, apply_words = WordsMatcher().prepare(torrent_info.title, _, apply_words = WordsMatcher().prepare(torrent_info.title,
custom_words=subscribe.custom_words.split("\n")) custom_words=subscribe.custom_words.split("\n"))
if apply_words: if apply_words:
logger.info(f'{torrent_info.site_name} - {torrent_info.title} 因订阅存在自定义识别词,重新识别元数据...') logger.info(
f'{torrent_info.site_name} - {torrent_info.title} 因订阅存在自定义识别词,重新识别元数据...')
# 重新识别元数据 # 重新识别元数据
torrent_meta = MetaInfo(title=torrent_info.title, subtitle=torrent_info.description, torrent_meta = MetaInfo(title=torrent_info.title, subtitle=torrent_info.description,
custom_words=subscribe.custom_word) custom_words=subscribe.custom_word)