fix 词表指定媒体ID的匹配

This commit is contained in:
jxxghp 2024-04-12 08:24:20 +08:00
parent 66af2de416
commit f17890b6ce
3 changed files with 32 additions and 10 deletions

View File

@ -177,12 +177,24 @@ class SearchChain(ChainBase):
torrent_meta = MetaInfo(title=torrent.title, subtitle=torrent.description) torrent_meta = MetaInfo(title=torrent.title, subtitle=torrent.description)
if torrent.title != torrent_meta.org_string: if torrent.title != torrent_meta.org_string:
logger.info(f"种子名称应用识别词后发生改变:{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, if self.torrenthelper.match_torrent(mediainfo=mediainfo,
torrent_meta=torrent_meta, torrent_meta=torrent_meta,
torrent=torrent): torrent=torrent):
# 匹配成功 # 匹配成功
_match_torrents.append(torrent) _match_torrents.append(torrent)
continue
# 匹配完成 # 匹配完成
logger.info(f"匹配完成,共匹配到 {len(_match_torrents)} 个资源") logger.info(f"匹配完成,共匹配到 {len(_match_torrents)} 个资源")
self.progress.update(value=97, self.progress.update(value=97,
@ -198,7 +210,7 @@ class SearchChain(ChainBase):
# 取搜索优先级规则 # 取搜索优先级规则
priority_rule = self.systemconfig.get(SystemConfigKey.SearchFilterRules) priority_rule = self.systemconfig.get(SystemConfigKey.SearchFilterRules)
if priority_rule: if priority_rule:
logger.info(f'开始优先级规则过滤,当前规则:{priority_rule} ...') logger.info(f'开始优先级规则/剧集过滤,当前规则:{priority_rule} ...')
result: List[TorrentInfo] = self.filter_torrents(rule_string=priority_rule, result: List[TorrentInfo] = self.filter_torrents(rule_string=priority_rule,
torrent_list=_match_torrents, torrent_list=_match_torrents,
season_episodes=season_episodes, season_episodes=season_episodes,

View File

@ -602,6 +602,16 @@ class SubscribeChain(ChainBase):
f'{mediainfo.title_year} 通过媒体信ID匹配到资源{torrent_info.site_name} - {torrent_info.title}') f'{mediainfo.title_year} 通过媒体信ID匹配到资源{torrent_info.site_name} - {torrent_info.title}')
else: else:
# 没有torrent_mediainfo媒体信息按标题匹配 # 没有torrent_mediainfo媒体信息按标题匹配
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, if not self.torrenthelper.match_torrent(mediainfo=mediainfo,
torrent_meta=torrent_meta, torrent_meta=torrent_meta,
torrent=torrent_info, torrent=torrent_info,

View File

@ -163,13 +163,13 @@ class FilterModule(_ModuleBase):
# 返回种子列表 # 返回种子列表
ret_torrents = [] ret_torrents = []
for torrent in torrent_list: for torrent in torrent_list:
# 能命中优先级的才返回
if not self.__get_order(torrent, rule_string):
continue
# 季集数过滤 # 季集数过滤
if season_episodes \ if season_episodes \
and not self.__match_season_episodes(torrent, season_episodes): and not self.__match_season_episodes(torrent, season_episodes):
continue continue
# 能命中优先级的才返回
if not self.__get_order(torrent, rule_string):
continue
ret_torrents.append(torrent) ret_torrents.append(torrent)
return ret_torrents return ret_torrents
@ -191,7 +191,7 @@ class FilterModule(_ModuleBase):
torrent_episodes = meta.episode_list torrent_episodes = meta.episode_list
if not set(torrent_seasons).issubset(set(seasons)): 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 return False
if not torrent_episodes: if not torrent_episodes:
# 整季按匹配处理 # 整季按匹配处理