fix 年份匹配
This commit is contained in:
parent
1b64ff0469
commit
db4b9fcef8
@ -386,7 +386,7 @@ class DownloadChain(ChainBase):
|
||||
# 所有剧集均缺失
|
||||
for season, episodes in mediainfo.seasons.items():
|
||||
# 全季不存在
|
||||
if meta.get_season_list() \
|
||||
if meta.begin_season \
|
||||
and season not in meta.get_season_list():
|
||||
continue
|
||||
__append_no_exists(_season=season, _episodes=[], _total=len(episodes), _start=min(episodes))
|
||||
@ -394,7 +394,7 @@ class DownloadChain(ChainBase):
|
||||
else:
|
||||
# 存在一些,检查缺失的季集
|
||||
for season, episodes in mediainfo.seasons.items():
|
||||
if meta.get_season_list() \
|
||||
if meta.begin_season \
|
||||
and season not in meta.get_season_list():
|
||||
continue
|
||||
exist_seasons = exists_tvs.get("seasons")
|
||||
|
@ -8,6 +8,7 @@ from app.core.metainfo import MetaInfo
|
||||
from app.helper.sites import SitesHelper
|
||||
from app.log import logger
|
||||
from app.utils.string import StringUtils
|
||||
from app.utils.types import MediaType
|
||||
|
||||
|
||||
class SearchChain(ChainBase):
|
||||
@ -64,6 +65,7 @@ class SearchChain(ChainBase):
|
||||
logger.warn(f'{keyword or mediainfo.title} 未搜索到资源')
|
||||
return []
|
||||
# 过滤种子
|
||||
logger.info(f'开始过滤资源,当前规则:{settings.FILTER_RULE} ...')
|
||||
result: List[TorrentInfo] = self.filter_torrents(torrent_list=torrents,
|
||||
season_episodes=season_episodes)
|
||||
if result is not None:
|
||||
@ -72,6 +74,7 @@ class SearchChain(ChainBase):
|
||||
logger.warn(f'{keyword or mediainfo.title} 没有符合过滤条件的资源')
|
||||
return []
|
||||
# 过滤不匹配的资源
|
||||
logger.info(f'开始匹配,总 {len(torrents)} 个资源 ...')
|
||||
_match_torrents = []
|
||||
if mediainfo:
|
||||
for torrent in torrents:
|
||||
@ -84,6 +87,16 @@ class SearchChain(ChainBase):
|
||||
continue
|
||||
# 识别
|
||||
torrent_meta = MetaInfo(torrent.title, torrent.description)
|
||||
# 比对年份
|
||||
if torrent_meta.year and mediainfo.year:
|
||||
if mediainfo.type == MediaType.TV:
|
||||
# 剧集
|
||||
if torrent_meta.year not in [year for year in mediainfo.season_years.values()]:
|
||||
continue
|
||||
else:
|
||||
# 没有季的剧集或者电影
|
||||
if torrent_meta.year != mediainfo.year:
|
||||
continue
|
||||
# 比对标题
|
||||
if torrent_meta.get_name() in [mediainfo.title, mediainfo.original_title]:
|
||||
logger.info(f'{mediainfo.title} 匹配到资源:{torrent.site_name} - {torrent.title}')
|
||||
@ -98,6 +111,7 @@ class SearchChain(ChainBase):
|
||||
break
|
||||
else:
|
||||
_match_torrents = torrents
|
||||
logger.info(f"匹配完成,共匹配到 {len(_match_torrents)} 个资源")
|
||||
# 组装上下文返回
|
||||
return [Context(meta=MetaInfo(torrent.title),
|
||||
mediainfo=mediainfo,
|
||||
|
@ -105,7 +105,9 @@ class UserMessageChain(ChainBase):
|
||||
no_exists=no_exists)
|
||||
if not contexts:
|
||||
# 没有数据
|
||||
self.post_message(title=f"{mediainfo.title} 未搜索到资源!", userid=userid)
|
||||
self.post_message(title=f"{mediainfo.title}"
|
||||
f"{self._current_meta.get_season_string()} 未搜索到资源!",
|
||||
userid=userid)
|
||||
return
|
||||
# 搜索结果排序
|
||||
contexts = TorrentHelper.sort_torrents(contexts)
|
||||
|
@ -122,6 +122,8 @@ class MediaInfo:
|
||||
names: Optional[list] = []
|
||||
# 各季的剧集清单信息
|
||||
seasons: Optional[dict] = {}
|
||||
# 各季的年份
|
||||
season_years: Optional[dict] = {}
|
||||
# 二级分类
|
||||
category: str = ""
|
||||
# TMDB INFO
|
||||
@ -137,6 +139,7 @@ class MediaInfo:
|
||||
# 初始化
|
||||
self.seasons = {}
|
||||
self.names = []
|
||||
self.season_years = {}
|
||||
self.directors = []
|
||||
self.actors = []
|
||||
self.tmdb_info = {}
|
||||
@ -267,10 +270,17 @@ class MediaInfo:
|
||||
# 季集信息
|
||||
if info.get('seasons'):
|
||||
for season_info in info.get('seasons'):
|
||||
if not season_info.get("season_number"):
|
||||
# 季
|
||||
season = season_info.get("season_number")
|
||||
if not season:
|
||||
continue
|
||||
# 集
|
||||
episode_count = season_info.get("episode_count")
|
||||
self.seasons[season_info.get("season_number")] = list(range(1, episode_count + 1))
|
||||
self.seasons[season] = list(range(1, episode_count + 1))
|
||||
# 年份
|
||||
air_date = season_info.get("air_date")
|
||||
if air_date:
|
||||
self.season_years[season] = air_date[:4]
|
||||
# 海报
|
||||
if info.get('poster_path'):
|
||||
self.poster_path = f"https://{settings.TMDB_IMAGE_DOMAIN}/t/p/original{info.get('poster_path')}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user