fix
This commit is contained in:
parent
243aa28871
commit
a538dccc5a
@ -94,7 +94,7 @@ class MessageChain(ChainBase):
|
|||||||
if no_exists:
|
if no_exists:
|
||||||
# 发送消息
|
# 发送消息
|
||||||
messages = [
|
messages = [
|
||||||
f"第 {sea} 季缺失 {len(no_exist.episodes) or no_exist.total_episodes} 集"
|
f"第 {sea} 季缺失 {StringUtils.str_series(no_exist.episodes) if no_exist.episodes else no_exist.total_episodes} 集"
|
||||||
for sea, no_exist in no_exists.get(mediainfo.tmdb_id).items()]
|
for sea, no_exist in no_exists.get(mediainfo.tmdb_id).items()]
|
||||||
self.post_message(title=f"{mediainfo.title_year}:\n" + "\n".join(messages))
|
self.post_message(title=f"{mediainfo.title_year}:\n" + "\n".join(messages))
|
||||||
# 搜索种子,过滤掉不需要的剧集,以便选择
|
# 搜索种子,过滤掉不需要的剧集,以便选择
|
||||||
|
@ -113,7 +113,7 @@ class FilterModule(_ModuleBase):
|
|||||||
torrent_episodes = meta.episode_list
|
torrent_episodes = meta.episode_list
|
||||||
if not set(torrent_seasons).issubset(set(seasons)):
|
if not set(torrent_seasons).issubset(set(seasons)):
|
||||||
# 种子季不在过滤季中
|
# 种子季不在过滤季中
|
||||||
logger.info(f"种子 {torrent.title} 不是需要的季")
|
logger.info(f"种子 {torrent.site_name} - {torrent.title} 不是需要的季")
|
||||||
return False
|
return False
|
||||||
if not torrent_episodes:
|
if not torrent_episodes:
|
||||||
# 整季按匹配处理
|
# 整季按匹配处理
|
||||||
|
@ -552,3 +552,35 @@ class StringUtils:
|
|||||||
# 端口号不是整数,返回 None 表示无效
|
# 端口号不是整数,返回 None 表示无效
|
||||||
return None, None
|
return None, None
|
||||||
return domain, port
|
return domain, port
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def str_series(array: List[int]) -> str:
|
||||||
|
"""
|
||||||
|
将季集列表转化为字符串简写
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 确保数组按照升序排列
|
||||||
|
array.sort()
|
||||||
|
|
||||||
|
result = []
|
||||||
|
start = array[0]
|
||||||
|
end = array[0]
|
||||||
|
|
||||||
|
for i in range(1, len(array)):
|
||||||
|
if array[i] == end + 1:
|
||||||
|
end = array[i]
|
||||||
|
else:
|
||||||
|
if start == end:
|
||||||
|
result.append(str(start))
|
||||||
|
else:
|
||||||
|
result.append(f"{start}-{end}")
|
||||||
|
start = array[i]
|
||||||
|
end = array[i]
|
||||||
|
|
||||||
|
# 处理最后一个序列
|
||||||
|
if start == end:
|
||||||
|
result.append(str(start))
|
||||||
|
else:
|
||||||
|
result.append(f"{start}-{end}")
|
||||||
|
|
||||||
|
return ",".join(result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user