This commit is contained in:
jxxghp
2025-05-19 12:51:34 +08:00
parent 2254715190
commit 76659f8837
+10 -25
View File
@@ -562,7 +562,7 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
# 所有订阅 # 所有订阅
subscribes = self.subscribeoper.list(self.get_states_for_search('R')) subscribes = self.subscribeoper.list(self.get_states_for_search('R'))
# 预识别所有未识别的种子,并标记是否已识别过 # 预识别所有未识别的种子
processed_torrents = {} processed_torrents = {}
for domain, contexts in torrents.items(): for domain, contexts in torrents.items():
processed_torrents[domain] = [] processed_torrents[domain] = []
@@ -571,10 +571,6 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
_context = copy.deepcopy(context) _context = copy.deepcopy(context)
torrent_meta = _context.meta_info torrent_meta = _context.meta_info
torrent_mediainfo = _context.media_info torrent_mediainfo = _context.media_info
torrent_info = _context.torrent_info
# 标记是否已经尝试过识别(初始为False)
_context._recognized = False
# 如果种子未识别,尝试识别 # 如果种子未识别,尝试识别
if not torrent_mediainfo or (not torrent_mediainfo.tmdb_id and not torrent_mediainfo.douban_id): if not torrent_mediainfo or (not torrent_mediainfo.tmdb_id and not torrent_mediainfo.douban_id):
@@ -582,9 +578,7 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
if torrent_mediainfo: if torrent_mediainfo:
# 更新种子缓存 # 更新种子缓存
_context.media_info = torrent_mediainfo _context.media_info = torrent_mediainfo
# 标记为已尝试识别 # 添加已预处理
_context._recognized = True
processed_torrents[domain].append(_context) processed_torrents[domain].append(_context)
# 遍历订阅 # 遍历订阅
@@ -664,22 +658,12 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
custom_words=custom_words_list) custom_words=custom_words_list)
# 更新元数据缓存 # 更新元数据缓存
context.meta_info = torrent_meta context.meta_info = torrent_meta
# 媒体信息需要重新识别 # 重新识别媒体信息
need_reprocess = None torrent_mediainfo = self.recognize_media(meta=torrent_meta,
# 重置识别标记 episode_group=subscribe.episode_group)
_context._recognized = False if torrent_mediainfo:
# 更新种子缓存
# 重新识别媒体信息(仅当有自定义识别词或尚未尝试识别时才需要) context.media_info = torrent_mediainfo
if need_reprocess or (not _context._recognized and
(not torrent_mediainfo or
(not torrent_mediainfo.tmdb_id and not torrent_mediainfo.douban_id))):
torrent_mediainfo = self.recognize_media(meta=torrent_meta,
episode_group=subscribe.episode_group)
if torrent_mediainfo:
# 更新种子缓存
_context.media_info = torrent_mediainfo
# 标记为已尝试识别
_context._recognized = True
# 如果仍然没有识别到媒体信息,尝试标题匹配 # 如果仍然没有识别到媒体信息,尝试标题匹配
if not torrent_mediainfo or (not torrent_mediainfo.tmdb_id and not torrent_mediainfo.douban_id): if not torrent_mediainfo or (not torrent_mediainfo.tmdb_id and not torrent_mediainfo.douban_id):
@@ -692,7 +676,8 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
logger.info( logger.info(
f'{mediainfo.title_year} 通过标题匹配到可选资源:{torrent_info.site_name} - {torrent_info.title}') f'{mediainfo.title_year} 通过标题匹配到可选资源:{torrent_info.site_name} - {torrent_info.title}')
torrent_mediainfo = mediainfo torrent_mediainfo = mediainfo
_context.media_info = torrent_mediainfo # 更新种子缓存
context.media_info = mediainfo
else: else:
continue continue