fix #270 设置了开始集数时总集数比对出错的问题

This commit is contained in:
jxxghp 2023-08-25 17:05:31 +08:00
parent dbd858b27d
commit 3acb2b254c
2 changed files with 11 additions and 11 deletions

View File

@ -241,10 +241,10 @@ class DownloadChain(ChainBase):
获取需要的季的集数 获取需要的季的集数
""" """
if not no_exists.get(tmdbid): if not no_exists.get(tmdbid):
return 0 return 9999
no_exist = no_exists.get(tmdbid) no_exist = no_exists.get(tmdbid)
if not no_exist.get(season): if not no_exist.get(season):
return 0 return 9999
return no_exist[season].total_episode return no_exist[season].total_episode
# 分组排序 # 分组排序
@ -298,8 +298,8 @@ class DownloadChain(ChainBase):
if not torrent_path: if not torrent_path:
continue continue
torrent_episodes = self.torrent.get_torrent_episodes(torrent_files) torrent_episodes = self.torrent.get_torrent_episodes(torrent_files)
if not torrent_episodes \ if torrent_episodes \
or len(torrent_episodes) >= __get_season_episodes(need_tmdbid, and len(torrent_episodes) >= __get_season_episodes(need_tmdbid,
torrent_season[0]): torrent_season[0]):
# 下载 # 下载
download_id = self.download_single(context=context, download_id = self.download_single(context=context,

View File

@ -283,7 +283,7 @@ class SubscribeChain(ChainBase):
# 如果是电视剧过滤掉已经下载的集数 # 如果是电视剧过滤掉已经下载的集数
if torrent_mediainfo.type == MediaType.TV: if torrent_mediainfo.type == MediaType.TV:
if self.__check_subscribe_note(subscribe, torrent_meta.episode_list): if self.__check_subscribe_note(subscribe, torrent_meta.episode_list):
logger.info(f'{torrent_info.title} 对应剧集 {torrent_meta.episodes} 已下载过') logger.info(f'{torrent_info.title} 对应剧集 {torrent_meta.episode_list} 已下载过')
continue continue
else: else:
# 洗版时,非整季不要 # 洗版时,非整季不要
@ -488,11 +488,11 @@ class SubscribeChain(ChainBase):
set(torrent_meta.episode_list) set(torrent_meta.episode_list)
): ):
logger.info( logger.info(
f'{torrent_info.title} 对应剧集 {torrent_meta.episodes} 未包含缺失的剧集') f'{torrent_info.title} 对应剧集 {torrent_meta.episode_list} 未包含缺失的剧集')
continue continue
# 过滤掉已经下载的集数 # 过滤掉已经下载的集数
if self.__check_subscribe_note(subscribe, torrent_meta.episode_list): if self.__check_subscribe_note(subscribe, torrent_meta.episode_list):
logger.info(f'{torrent_info.title} 对应剧集 {torrent_meta.episodes} 已下载过') logger.info(f'{torrent_info.title} 对应剧集 {torrent_meta.episode_list} 已下载过')
continue continue
else: else:
# 洗版时,非整季不要 # 洗版时,非整季不要
@ -670,8 +670,8 @@ class SubscribeChain(ChainBase):
:param no_exists: 缺失季集列表 :param no_exists: 缺失季集列表
:param tmdb_id: TMDB ID :param tmdb_id: TMDB ID
:param begin_season: 开始季 :param begin_season: 开始季
:param total_episode: 总集数 :param total_episode: 订阅设定总集数
:param start_episode: 开始集数 :param start_episode: 订阅设定开始集数
""" """
# 使用订阅的总集数和开始集数替换no_exists # 使用订阅的总集数和开始集数替换no_exists
if no_exists \ if no_exists \
@ -696,7 +696,7 @@ class SubscribeChain(ChainBase):
elif not total_episode: elif not total_episode:
# 有开始集没有总集数 # 有开始集没有总集数
episodes = list(range(start_episode, max(episode_list or [total]) + 1)) episodes = list(range(start_episode, max(episode_list or [total]) + 1))
total_episode = max(episode_list or [total]) total_episode = no_exist_season.total_episode
else: else:
return no_exists return no_exists
# 与原有集取交集 # 与原有集取交集