fix context
This commit is contained in:
parent
541a8d725d
commit
7103eebf8e
@ -199,6 +199,8 @@ class SearchChain(ChainBase):
|
||||
else:
|
||||
_match_torrents = torrents
|
||||
logger.info(f"匹配完成,共匹配到 {len(_match_torrents)} 个资源")
|
||||
# 去掉mediainfo中多余的数据
|
||||
mediainfo.clear()
|
||||
# 组装上下文
|
||||
contexts = [Context(meta_info=MetaInfo(title=torrent.title, subtitle=torrent.description),
|
||||
media_info=mediainfo,
|
||||
@ -262,7 +264,7 @@ class SearchChain(ChainBase):
|
||||
finish_count += 1
|
||||
result = future.result()
|
||||
if result:
|
||||
results += result
|
||||
results.extend(result)
|
||||
logger.info(f"站点搜索进度:{finish_count} / {total_num}")
|
||||
self.progress.update(value=finish_count / total_num * 100,
|
||||
text=f"正在搜索,已完成 {finish_count} / {total_num} 个站点 ...",
|
||||
|
@ -388,6 +388,8 @@ class SubscribeChain(ChainBase):
|
||||
logger.warn(f'未识别到媒体信息,标题:{torrent.title}')
|
||||
# 存储空的媒体信息
|
||||
mediainfo = MediaInfo()
|
||||
# 清理多余数据
|
||||
mediainfo.clear()
|
||||
# 上下文
|
||||
context = Context(meta_info=meta, media_info=mediainfo, torrent_info=torrent)
|
||||
# 添加到缓存
|
||||
|
@ -551,6 +551,24 @@ class MediaInfo:
|
||||
dicts["title_year"] = self.title_year
|
||||
return dicts
|
||||
|
||||
def clear(self):
|
||||
"""
|
||||
去除多余数据,减小体积
|
||||
"""
|
||||
self.tmdb_info = {}
|
||||
self.douban_info = {}
|
||||
self.seasons = {}
|
||||
self.genres = []
|
||||
self.season_info = []
|
||||
self.names = []
|
||||
self.actors = []
|
||||
self.directors = []
|
||||
self.production_companies = []
|
||||
self.production_countries = []
|
||||
self.spoken_languages = []
|
||||
self.networks = []
|
||||
self.next_episode_to_air = {}
|
||||
|
||||
|
||||
@dataclass
|
||||
class Context:
|
||||
|
Loading…
x
Reference in New Issue
Block a user