fix neodbsync

This commit is contained in:
hcplantern
2024-04-09 14:15:52 +08:00
parent b579fafc97
commit ab0d011b56
2 changed files with 12 additions and 37 deletions

View File

@@ -394,7 +394,7 @@
"NeoDBSync": {
"name": "NeoDB 想看",
"description": "同步 NeoDB 想看条目,自动添加订阅。",
"version": "1.0",
"version": "1.1",
"icon": "NeoDB.jpeg",
"author": "hcplantern",
"level": 1

View File

@@ -32,7 +32,7 @@ class NeoDBSync(_PluginBase):
# 插件图标
plugin_icon = "NeoDB.jpeg"
# 插件版本
plugin_version = "1.0"
plugin_version = "1.1"
# 插件作者
plugin_author = "hcplantern"
# 作者主页
@@ -547,41 +547,16 @@ class NeoDBSync(_PluginBase):
logger.info(f'{mediainfo.title_year} 媒体库中已存在')
action = "exist"
else:
logger.info(f'{mediainfo.title_year} 媒体库中不存在,开始搜索 ...')
# 搜索
contexts = self.searchchain.process(mediainfo=mediainfo,
no_exists=no_exists)
if not contexts:
logger.warn(f'{mediainfo.title_year} 未搜索到资源')
# 添加订阅
self.subscribechain.add(title=mediainfo.title,
year=mediainfo.year,
mtype=mediainfo.type,
tmdbid=mediainfo.tmdb_id,
season=meta.begin_season,
exist_ok=True,
username="NeoDB 想看")
action = "subscribe"
else:
# 自动下载
downloads, lefts = self.downloadchain.batch_download(contexts=contexts, no_exists=no_exists,
username="NeoDB 想看")
if downloads and not lefts:
# 全部下载完成
logger.info(f'{mediainfo.title_year} 下载完成')
action = "download"
else:
# 未完成下载
logger.info(f'{mediainfo.title_year} 未下载未完整,添加订阅 ...')
# 添加订阅
self.subscribechain.add(title=mediainfo.title,
year=mediainfo.year,
mtype=mediainfo.type,
tmdbid=mediainfo.tmdb_id,
season=meta.begin_season,
exist_ok=True,
username="NeoDB 想看")
action = "subscribe"
# 添加订阅
logger.info(f'{mediainfo.title_year} 媒体库中不存在或不完整,添加订阅 ...')
self.subscribechain.add(title=mediainfo.title,
year=mediainfo.year,
mtype=mediainfo.type,
tmdbid=mediainfo.tmdb_id,
season=meta.begin_season,
exist_ok=True,
username="NeoDB 想看")
action = "subscribe"
# 存储历史记录
history.append({
"action": action,