fix 搜索匹配Bug

This commit is contained in:
jxxghp 2023-07-12 21:49:35 +08:00
parent 0900ab4891
commit 41bc1a9d4d
2 changed files with 15 additions and 3 deletions

View File

@ -166,14 +166,17 @@ class SearchChain(ChainBase):
logger.warn(f'{torrent.site_name} - {torrent.title} 年份不匹配') logger.warn(f'{torrent.site_name} - {torrent.title} 年份不匹配')
continue continue
# 比对标题 # 比对标题
if torrent_meta.name in [mediainfo.title, mediainfo.original_title]: meta_name = StringUtils.clear_upper(torrent_meta.name)
if meta_name in [
StringUtils.clear_upper(mediainfo.title),
StringUtils.clear_upper(mediainfo.original_title)
]:
logger.info(f'{mediainfo.title} 匹配到资源:{torrent.site_name} - {torrent.title}') logger.info(f'{mediainfo.title} 匹配到资源:{torrent.site_name} - {torrent.title}')
_match_torrents.append(torrent) _match_torrents.append(torrent)
continue continue
# 比对别名和译名 # 比对别名和译名
for name in mediainfo.names: for name in mediainfo.names:
if StringUtils.clear(name).strip().upper() == \ if StringUtils.clear_upper(name) == meta_name:
StringUtils.clear(torrent_meta.name).strip().upper():
logger.info(f'{mediainfo.title} 匹配到资源:{torrent.site_name} - {torrent.title}') logger.info(f'{mediainfo.title} 匹配到资源:{torrent.site_name} - {torrent.title}')
_match_torrents.append(torrent) _match_torrents.append(torrent)
break break

View File

@ -169,6 +169,15 @@ class StringUtils:
else: else:
return [StringUtils.clear(x) for x in text] return [StringUtils.clear(x) for x in text]
@staticmethod
def clear_upper(text: str) -> str:
"""
去除特殊字符同时大写
"""
if not text:
return ""
return StringUtils.clear(text).upper().strip()
@staticmethod @staticmethod
def str_filesize(size: Union[str, float, int], pre: int = 2) -> str: def str_filesize(size: Union[str, float, int], pre: int = 2) -> str:
""" """