fix tmdb match
This commit is contained in:
@ -7,6 +7,7 @@ from app.core.meta import MetaBase
|
||||
from app.core.metainfo import MetaInfo
|
||||
from app.helper.sites import SitesHelper
|
||||
from app.log import logger
|
||||
from app.utils.string import StringUtils
|
||||
|
||||
|
||||
class SearchChain(ChainBase):
|
||||
@ -70,20 +71,23 @@ class SearchChain(ChainBase):
|
||||
if torrent.imdbid \
|
||||
and mediainfo.imdb_id \
|
||||
and torrent.imdbid == mediainfo.imdb_id:
|
||||
logger.info(f'{mediainfo.title} 匹配到资源:{torrent.title}')
|
||||
_match_torrents.append(torrent)
|
||||
continue
|
||||
# 识别
|
||||
torrent_meta = MetaInfo(torrent.title, torrent.description)
|
||||
# 识别媒体信息
|
||||
torrent_mediainfo: MediaInfo = self.recognize_media(meta=torrent_meta)
|
||||
if not torrent_mediainfo:
|
||||
logger.warn(f'未识别到媒体信息,标题:{torrent.title}')
|
||||
continue
|
||||
# 过滤
|
||||
if torrent_mediainfo.tmdb_id == mediainfo.tmdb_id \
|
||||
and torrent_mediainfo.type == mediainfo.type:
|
||||
# 比对标题
|
||||
if torrent_meta.get_name() in [mediainfo.title, mediainfo.original_title]:
|
||||
logger.info(f'{mediainfo.title} 匹配到资源:{torrent.title}')
|
||||
_match_torrents.append(torrent)
|
||||
continue
|
||||
# 比对别名和译名
|
||||
for name in mediainfo.names:
|
||||
if StringUtils.clear(name).strip().upper() == \
|
||||
StringUtils.clear(torrent_meta.get_name()).strip().upper():
|
||||
logger.info(f'{mediainfo.title} 匹配到资源:{torrent.title}')
|
||||
_match_torrents.append(torrent)
|
||||
break
|
||||
else:
|
||||
_match_torrents = torrents
|
||||
# 组装上下文返回
|
||||
|
Reference in New Issue
Block a user