fix 搜索匹配Bug
This commit is contained in:
parent
0900ab4891
commit
41bc1a9d4d
@ -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
|
||||||
|
@ -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:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user