diff --git a/app/chain/search.py b/app/chain/search.py index db76e29a..ac24d87d 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -177,12 +177,24 @@ class SearchChain(ChainBase): torrent_meta = MetaInfo(title=torrent.title, subtitle=torrent.description) if torrent.title != torrent_meta.org_string: logger.info(f"种子名称应用识别词后发生改变:{torrent.title} => {torrent_meta.org_string}") + # 比对词条指定的tmdbid + if torrent_meta.tmdbid or torrent_meta.doubanid: + if torrent_meta.tmdbid and torrent_meta.tmdbid == mediainfo.tmdb_id: + logger.info(f'{mediainfo.title} 通过词表指定TMDBID匹配到资源:{torrent.site_name} - {torrent.title}') + _match_torrents.append(torrent) + continue + if torrent_meta.doubanid and torrent_meta.doubanid == mediainfo.douban_id: + logger.info(f'{mediainfo.title} 通过词表指定豆瓣ID匹配到资源:{torrent.site_name} - {torrent.title}') + _match_torrents.append(torrent) + continue + # 比对种子 if self.torrenthelper.match_torrent(mediainfo=mediainfo, torrent_meta=torrent_meta, torrent=torrent): # 匹配成功 _match_torrents.append(torrent) + continue # 匹配完成 logger.info(f"匹配完成,共匹配到 {len(_match_torrents)} 个资源") self.progress.update(value=97, @@ -198,7 +210,7 @@ class SearchChain(ChainBase): # 取搜索优先级规则 priority_rule = self.systemconfig.get(SystemConfigKey.SearchFilterRules) if priority_rule: - logger.info(f'开始优先级规则过滤,当前规则:{priority_rule} ...') + logger.info(f'开始优先级规则/剧集过滤,当前规则:{priority_rule} ...') result: List[TorrentInfo] = self.filter_torrents(rule_string=priority_rule, torrent_list=_match_torrents, season_episodes=season_episodes, diff --git a/app/chain/subscribe.py b/app/chain/subscribe.py index 3b7b0cf0..4a9725a4 100644 --- a/app/chain/subscribe.py +++ b/app/chain/subscribe.py @@ -602,11 +602,21 @@ class SubscribeChain(ChainBase): f'{mediainfo.title_year} 通过媒体信ID匹配到资源:{torrent_info.site_name} - {torrent_info.title}') else: # 没有torrent_mediainfo媒体信息,按标题匹配 - if not self.torrenthelper.match_torrent(mediainfo=mediainfo, - torrent_meta=torrent_meta, - torrent=torrent_info, - logerror=False): - continue + manual_match = False + # 比对词条指定的tmdbid + if torrent_meta.tmdbid or torrent_meta.doubanid: + if torrent_meta.tmdbid and torrent_meta.tmdbid != mediainfo.tmdb_id: + continue + if torrent_meta.doubanid and torrent_meta.doubanid != mediainfo.douban_id: + continue + manual_match = True + if not manual_match: + # 没有指定tmdbid,按标题匹配 + if not self.torrenthelper.match_torrent(mediainfo=mediainfo, + torrent_meta=torrent_meta, + torrent=torrent_info, + logerror=False): + continue # 优先级过滤规则 if subscribe.best_version: priority_rule = self.systemconfig.get(SystemConfigKey.BestVersionFilterRules) diff --git a/app/modules/filter/__init__.py b/app/modules/filter/__init__.py index 1b01759f..db3904fa 100644 --- a/app/modules/filter/__init__.py +++ b/app/modules/filter/__init__.py @@ -163,13 +163,13 @@ class FilterModule(_ModuleBase): # 返回种子列表 ret_torrents = [] for torrent in torrent_list: - # 能命中优先级的才返回 - if not self.__get_order(torrent, rule_string): - continue # 季集数过滤 if season_episodes \ and not self.__match_season_episodes(torrent, season_episodes): continue + # 能命中优先级的才返回 + if not self.__get_order(torrent, rule_string): + continue ret_torrents.append(torrent) return ret_torrents @@ -191,7 +191,7 @@ class FilterModule(_ModuleBase): torrent_episodes = meta.episode_list if not set(torrent_seasons).issubset(set(seasons)): # 种子季不在过滤季中 - logger.info(f"种子 {torrent.site_name} - {torrent.title} 不是需要的季") + logger.info(f"种子 {torrent.site_name} - {torrent.title} 包含季 {torrent_seasons} 不是需要的季 {seasons}") return False if not torrent_episodes: # 整季按匹配处理