diff --git a/app/chain/search.py b/app/chain/search.py index 08046c6c..02484bc4 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -105,7 +105,8 @@ class SearchChain(ChainBase): sites: List[int] = None, rule_groups: List[str] = None, 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过滤本地已存在的资源 :param mediainfo: 媒体信息 @@ -231,6 +232,12 @@ class SearchChain(ChainBase): logger.info(f'{mediainfo.title} 通过IMDBID匹配到资源:{torrent.site_name} - {torrent.title}') _match_torrents.append((torrent, torrent_meta)) 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, torrent_meta=torrent_meta, diff --git a/app/chain/subscribe.py b/app/chain/subscribe.py index d795d07a..e6124f48 100644 --- a/app/chain/subscribe.py +++ b/app/chain/subscribe.py @@ -348,7 +348,8 @@ class SubscribeChain(ChainBase): sites=sites, rule_groups=rule_groups, 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: logger.warn(f'订阅 {subscribe.keyword or subscribe.name} 未搜索到资源') self.finish_subscribe_or_not(subscribe=subscribe, meta=meta, @@ -637,7 +638,8 @@ class SubscribeChain(ChainBase): _, apply_words = WordsMatcher().prepare(torrent_info.title, custom_words=subscribe.custom_words.split("\n")) 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, custom_words=subscribe.custom_word)