mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-13 15:09:12 +00:00
fix plugins
This commit is contained in:
@@ -67,7 +67,6 @@ class BangumiColl(_PluginBase):
|
|||||||
_group_select_order: list = []
|
_group_select_order: list = []
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
self.subscribeoper = SubscribeOper()
|
|
||||||
|
|
||||||
# 停止现有任务
|
# 停止现有任务
|
||||||
self.stop_service()
|
self.stop_service()
|
||||||
@@ -81,17 +80,17 @@ class BangumiColl(_PluginBase):
|
|||||||
if config:
|
if config:
|
||||||
# 遍历配置中的键并设置相应的属性
|
# 遍历配置中的键并设置相应的属性
|
||||||
for key in (
|
for key in (
|
||||||
"enabled",
|
"enabled",
|
||||||
"total_change",
|
"total_change",
|
||||||
"cron",
|
"cron",
|
||||||
"notify",
|
"notify",
|
||||||
"onlyonce",
|
"onlyonce",
|
||||||
"uid",
|
"uid",
|
||||||
"collection_type",
|
"collection_type",
|
||||||
"save_path",
|
"save_path",
|
||||||
"sites",
|
"sites",
|
||||||
"match_groups",
|
"match_groups",
|
||||||
"group_select_order",
|
"group_select_order",
|
||||||
):
|
):
|
||||||
setattr(self, f"_{key}", config.get(key, getattr(self, f"_{key}")))
|
setattr(self, f"_{key}", config.get(key, getattr(self, f"_{key}")))
|
||||||
# 获得所有站点
|
# 获得所有站点
|
||||||
@@ -108,8 +107,7 @@ class BangumiColl(_PluginBase):
|
|||||||
self._scheduler.add_job(
|
self._scheduler.add_job(
|
||||||
func=self.bangumi_coll,
|
func=self.bangumi_coll,
|
||||||
trigger='date',
|
trigger='date',
|
||||||
run_date=datetime.datetime.now(tz=pytz.timezone(settings.TZ))
|
run_date=datetime.datetime.now(tz=pytz.timezone(settings.TZ)) + datetime.timedelta(seconds=3),
|
||||||
+ datetime.timedelta(seconds=3),
|
|
||||||
)
|
)
|
||||||
self._scheduler.start()
|
self._scheduler.start()
|
||||||
|
|
||||||
@@ -275,9 +273,8 @@ class BangumiColl(_PluginBase):
|
|||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'div',
|
'component': 'div',
|
||||||
'props': {'innerHTML':
|
'props': {
|
||||||
'提示:<strong>剧集组优先级</strong>越靠前优先级越高。'
|
'innerHTML': '提示:<strong>剧集组优先级</strong>越靠前优先级越高。'}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -385,9 +382,8 @@ class BangumiColl(_PluginBase):
|
|||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'div',
|
'component': 'div',
|
||||||
'props': {'innerHTML':
|
'props': {
|
||||||
'注意: 该插件仅会将<strong>公开</strong>的收藏添加到<strong>订阅</strong>。'
|
'innerHTML': '注意: 该插件仅会将<strong>公开</strong>的收藏添加到<strong>订阅</strong>。'}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -414,9 +410,8 @@ class BangumiColl(_PluginBase):
|
|||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'div',
|
'component': 'div',
|
||||||
'props': {'innerHTML':
|
'props': {
|
||||||
'注意: 开启<strong>自动取消订阅并通知</strong>后,已添加的订阅在下一次执行时若不在已选择的<strong>收藏类型</strong>中,将会被取消订阅。'
|
'innerHTML': '注意: 开启<strong>自动取消订阅并通知</strong>后,已添加的订阅在下一次执行时若不在已选择的<strong>收藏类型</strong>中,将会被取消订阅。'}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -443,9 +438,9 @@ class BangumiColl(_PluginBase):
|
|||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'div',
|
'component': 'div',
|
||||||
'props': {'innerHTML':
|
'props': {
|
||||||
'注意: 开启<strong>固定总集数</strong>后,从<a href="https://bangumi.github.io/api/#/%E7%AB%A0%E8%8A%82/getEpisodes" target="_blank"><u>Bangumi API</u></a>获取到总集数将不会因<strong>订阅元数据更新</strong>改变。'
|
'innerHTML': '注意: 开启<strong>固定总集数</strong>后,从<a href="https://bangumi.github.io/api/#/%E7%AB%A0%E8%8A%82/getEpisodes" target="_blank"><u>Bangumi API</u></a>获取到总集数将不会因<strong>订阅元数据更新</strong>改变。'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -513,11 +508,11 @@ class BangumiColl(_PluginBase):
|
|||||||
def get_command(self):
|
def get_command(self):
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"cmd": "/bangumi_coll",
|
"cmd": "/bangumi_coll",
|
||||||
"event": EventType.PluginAction,
|
"event": EventType.PluginAction,
|
||||||
"desc": "Bangumi收藏订阅",
|
"desc": "Bangumi收藏订阅",
|
||||||
"category": "",
|
"category": "",
|
||||||
"data": {"action": "bangumi_coll"}
|
"data": {"action": "bangumi_coll"}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -537,21 +532,21 @@ class BangumiColl(_PluginBase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.post_message(channel=event_data.get("channel"),
|
self.post_message(channel=event_data.get("channel"),
|
||||||
title=f"开始添加用户: {self._uid} 的收藏 ...",
|
title=f"开始添加用户: {self._uid} 的收藏 ...",
|
||||||
userid=event_data.get("user"))
|
userid=event_data.get("user"))
|
||||||
# 运行任务
|
# 运行任务
|
||||||
msg = self.bangumi_coll()
|
msg = self.bangumi_coll()
|
||||||
|
|
||||||
self.post_message(channel=event_data.get("channel"),
|
self.post_message(channel=event_data.get("channel"),
|
||||||
title="添加完成" if not msg else msg,
|
title="添加完成" if not msg else msg,
|
||||||
userid=event_data.get("user"))
|
userid=event_data.get("user"))
|
||||||
|
|
||||||
def bangumi_coll(self) -> str:
|
def bangumi_coll(self) -> str:
|
||||||
"""订阅Bangumi用户收藏"""
|
"""订阅Bangumi用户收藏"""
|
||||||
if not self._uid:
|
if not self._uid:
|
||||||
logger.error("未设置UID")
|
logger.error("未设置UID")
|
||||||
return "未设置UID"
|
return "未设置UID"
|
||||||
|
msg = ""
|
||||||
try:
|
try:
|
||||||
res = self.get_bgm_res(addr="UserCollections", id=self._uid)
|
res = self.get_bgm_res(addr="UserCollections", id=self._uid)
|
||||||
items = self.parse_collection_items(res)
|
items = self.parse_collection_items(res)
|
||||||
@@ -582,9 +577,8 @@ class BangumiColl(_PluginBase):
|
|||||||
"tags": [tag.get('name') for tag in item['subject'].get('tags', [{}])]
|
"tags": [tag.get('name') for tag in item['subject'].get('tags', [{}])]
|
||||||
}
|
}
|
||||||
for item in data
|
for item in data
|
||||||
if item.get("type") in self._collection_type and item['subject'].get('date')\
|
|
||||||
# 只添加未来30天内放送的条目
|
# 只添加未来30天内放送的条目
|
||||||
and self.is_date_in_range(item['subject'].get('date'), threshold_days=30)[0]
|
if item.get("type") in self._collection_type and item['subject'].get('date') and self.is_date_in_range(item['subject'].get('date'), threshold_days=30)[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
def manage_subscriptions(self, items: Dict[int, Dict[str, Any]]):
|
def manage_subscriptions(self, items: Dict[int, Dict[str, Any]]):
|
||||||
@@ -592,7 +586,7 @@ class BangumiColl(_PluginBase):
|
|||||||
# 查询订阅
|
# 查询订阅
|
||||||
db_sub = {
|
db_sub = {
|
||||||
i.bangumiid: i.id
|
i.bangumiid: i.id
|
||||||
for i in self.subscribeoper.list()
|
for i in SubscribeOper().list()
|
||||||
if i.bangumiid
|
if i.bangumiid
|
||||||
}
|
}
|
||||||
# bangumi 条目
|
# bangumi 条目
|
||||||
@@ -627,6 +621,7 @@ class BangumiColl(_PluginBase):
|
|||||||
"""添加订阅"""
|
"""添加订阅"""
|
||||||
|
|
||||||
fail_items = {}
|
fail_items = {}
|
||||||
|
subscribeoper = SubscribeOper()
|
||||||
for subid, item in items.items():
|
for subid, item in items.items():
|
||||||
if item.get("name_cn"):
|
if item.get("name_cn"):
|
||||||
meta = MetaInfo(item.get("name_cn"))
|
meta = MetaInfo(item.get("name_cn"))
|
||||||
@@ -651,9 +646,9 @@ class BangumiColl(_PluginBase):
|
|||||||
meta.en_name = meta.title
|
meta.en_name = meta.title
|
||||||
|
|
||||||
if (mediainfo := self.chain.recognize_media(
|
if (mediainfo := self.chain.recognize_media(
|
||||||
meta=meta,
|
meta=meta,
|
||||||
mtype=mtype,
|
mtype=mtype,
|
||||||
cache=False
|
cache=False
|
||||||
)) or any(
|
)) or any(
|
||||||
getattr(meta, attr) == meta.org_string
|
getattr(meta, attr) == meta.org_string
|
||||||
for attr in ('cn_name', 'en_name')
|
for attr in ('cn_name', 'en_name')
|
||||||
@@ -668,9 +663,10 @@ class BangumiColl(_PluginBase):
|
|||||||
mediainfo.bangumi_id = subid
|
mediainfo.bangumi_id = subid
|
||||||
# 根据发行日期判断是不是续作
|
# 根据发行日期判断是不是续作
|
||||||
if mediainfo.type == MediaType.TV \
|
if mediainfo.type == MediaType.TV \
|
||||||
and not self.is_date_in_range(sub_air_date, mediainfo.release_date)[0]:
|
and not self.is_date_in_range(sub_air_date, mediainfo.release_date)[0]:
|
||||||
# 识别剧集组标志
|
# 识别剧集组标志
|
||||||
group_flag: bool = True
|
group_flag: bool = True
|
||||||
|
season_info = []
|
||||||
if "OVA" in item.get("tags"):
|
if "OVA" in item.get("tags"):
|
||||||
# 季0 处理
|
# 季0 处理
|
||||||
if tmdb_info := self.chain.tmdb_info(mediainfo.tmdb_id, mediainfo.type, 0):
|
if tmdb_info := self.chain.tmdb_info(mediainfo.tmdb_id, mediainfo.type, 0):
|
||||||
@@ -678,12 +674,13 @@ class BangumiColl(_PluginBase):
|
|||||||
if self.is_date_in_range(sub_air_date, info.get("air_date"), 2)[0]:
|
if self.is_date_in_range(sub_air_date, info.get("air_date"), 2)[0]:
|
||||||
mediainfo.season = 0
|
mediainfo.season = 0
|
||||||
meta.begin_episode = info.get("episode_number")
|
meta.begin_episode = info.get("episode_number")
|
||||||
else: # 信息不完整, 跳过条目
|
else: # 信息不完整, 跳过条目
|
||||||
continue
|
continue
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# 过滤信息不完整和第0季
|
# 过滤信息不完整和第0季
|
||||||
season_info = [info for info in mediainfo.season_info if info.get("season_number") and info.get("air_date") and info.get("episode_count")]
|
season_info = [info for info in mediainfo.season_info if
|
||||||
|
info.get("season_number") and info.get("air_date") and info.get("episode_count")]
|
||||||
# 获取 bangumi 信息
|
# 获取 bangumi 信息
|
||||||
meta = self.get_eps(meta, subid)
|
meta = self.get_eps(meta, subid)
|
||||||
# 先通过season_info处理三季及以上的情况, tmdb存在第二季也不能保证不会被合并
|
# 先通过season_info处理三季及以上的情况, tmdb存在第二季也不能保证不会被合并
|
||||||
@@ -718,16 +715,16 @@ class BangumiColl(_PluginBase):
|
|||||||
season_list = []
|
season_list = []
|
||||||
for info in mediainfo.season_info:
|
for info in mediainfo.season_info:
|
||||||
if info.get("season_number") == 0:
|
if info.get("season_number") == 0:
|
||||||
season_list.append((len(season_info)+1, len(mediainfo.seasons[1])+info.get("episode_count")))
|
season_list.append(
|
||||||
|
(len(season_info) + 1, len(mediainfo.seasons[1]) + info.get("episode_count")))
|
||||||
season_list.append((len(season_info), len(mediainfo.seasons[1])))
|
season_list.append((len(season_info), len(mediainfo.seasons[1])))
|
||||||
# 预匹配剧集组
|
# 预匹配剧集组
|
||||||
candidate_groups = (
|
candidate_groups = (
|
||||||
group for group in mediainfo.episode_groups
|
group for group in mediainfo.episode_groups
|
||||||
if any(
|
if any(group.get("group_count") == s[0] and
|
||||||
group.get("group_count") == s[0] and
|
group.get("episode_count") == s[1]
|
||||||
group.get("episode_count") == s[1]
|
for s in season_list
|
||||||
for s in season_list
|
)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for group in candidate_groups:
|
for group in candidate_groups:
|
||||||
@@ -738,7 +735,8 @@ class BangumiColl(_PluginBase):
|
|||||||
else:
|
else:
|
||||||
mediainfo = self._match_group(air_date, meta, mediainfo)
|
mediainfo = self._match_group(air_date, meta, mediainfo)
|
||||||
# 非续作
|
# 非续作
|
||||||
elif mediainfo.type == MediaType.TV: mediainfo.season = 1
|
elif mediainfo.type == MediaType.TV:
|
||||||
|
mediainfo.season = 1
|
||||||
# 检查本地媒体
|
# 检查本地媒体
|
||||||
exist_flag, no_exists = DownloadChain().get_no_exists_info(meta=meta, mediainfo=mediainfo)
|
exist_flag, no_exists = DownloadChain().get_no_exists_info(meta=meta, mediainfo=mediainfo)
|
||||||
if exist_flag:
|
if exist_flag:
|
||||||
@@ -751,13 +749,13 @@ class BangumiColl(_PluginBase):
|
|||||||
self.update_data(key="exclude", value=subid)
|
self.update_data(key="exclude", value=subid)
|
||||||
logger.info(f'{mediainfo.title_year} 媒体库中已存在 第 {mediainfo.season} 季')
|
logger.info(f'{mediainfo.title_year} 媒体库中已存在 第 {mediainfo.season} 季')
|
||||||
continue
|
continue
|
||||||
sid = self.subscribeoper.list_by_tmdbid(
|
sid = subscribeoper.list_by_tmdbid(
|
||||||
mediainfo.tmdb_id, mediainfo.season
|
mediainfo.tmdb_id, mediainfo.season
|
||||||
)
|
)
|
||||||
if sid:
|
if sid:
|
||||||
logger.info(f"{mediainfo.title_year} 正在订阅中")
|
logger.info(f"{mediainfo.title_year} 正在订阅中")
|
||||||
if len(sid) == 1:
|
if len(sid) == 1:
|
||||||
self.subscribeoper.update(
|
subscribeoper.update(
|
||||||
sid=sid[0].id, payload={"bangumiid": subid}
|
sid=sid[0].id, payload={"bangumiid": subid}
|
||||||
)
|
)
|
||||||
logger.info(f"{mediainfo.title_year} Bangumi条目id更新成功")
|
logger.info(f"{mediainfo.title_year} Bangumi条目id更新成功")
|
||||||
@@ -773,6 +771,7 @@ class BangumiColl(_PluginBase):
|
|||||||
"""
|
"""
|
||||||
将tmdb多季合并的季信息进行拆分
|
将tmdb多季合并的季信息进行拆分
|
||||||
"""
|
"""
|
||||||
|
season_data = {}
|
||||||
if tmdb_info := self.chain.tmdb_info(mediainfo.tmdb_id, mediainfo.type, season):
|
if tmdb_info := self.chain.tmdb_info(mediainfo.tmdb_id, mediainfo.type, season):
|
||||||
season = 1
|
season = 1
|
||||||
air_date = tmdb_info.get("air_date")
|
air_date = tmdb_info.get("air_date")
|
||||||
@@ -824,8 +823,8 @@ class BangumiColl(_PluginBase):
|
|||||||
episode_count = group.get("episode_count", 0)
|
episode_count = group.get("episode_count", 0)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
group_count >= total_season
|
group_count >= total_season
|
||||||
and episode_count >= begin_ep
|
and episode_count >= begin_ep
|
||||||
):
|
):
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{mediainfo.title_year} 正在匹配 剧集组: "
|
f"{mediainfo.title_year} 正在匹配 剧集组: "
|
||||||
@@ -833,8 +832,8 @@ class BangumiColl(_PluginBase):
|
|||||||
f"共 {group_count} 季 {episode_count} 集")
|
f"共 {group_count} 季 {episode_count} 集")
|
||||||
|
|
||||||
if season_num := self.get_group_season(
|
if season_num := self.get_group_season(
|
||||||
group.get("id"), air_date, mediainfo
|
group.get("id"), air_date, mediainfo
|
||||||
):
|
):
|
||||||
mediainfo.episode_group = group.get("id")
|
mediainfo.episode_group = group.get("id")
|
||||||
mediainfo.season = season_num
|
mediainfo.season = season_num
|
||||||
return mediainfo
|
return mediainfo
|
||||||
@@ -883,9 +882,9 @@ class BangumiColl(_PluginBase):
|
|||||||
|
|
||||||
total_episode = len(mediainfo.seasons.get(mediainfo.season or 1) or [])
|
total_episode = len(mediainfo.seasons.get(mediainfo.season or 1) or [])
|
||||||
if (
|
if (
|
||||||
meta.begin_season
|
meta.begin_season
|
||||||
and mediainfo.season != meta.begin_season
|
and mediainfo.season != meta.begin_season
|
||||||
or total_episode != meta.total_episode
|
or total_episode != meta.total_episode
|
||||||
):
|
):
|
||||||
meta = self.get_eps(meta, mediainfo.bangumi_id)
|
meta = self.get_eps(meta, mediainfo.bangumi_id)
|
||||||
total_ep: int = meta.end_episode if meta.end_episode else total_episode
|
total_ep: int = meta.end_episode if meta.end_episode else total_episode
|
||||||
@@ -947,10 +946,11 @@ class BangumiColl(_PluginBase):
|
|||||||
# 移除订阅
|
# 移除订阅
|
||||||
def delete_subscribe(self, del_items: dict[int, int]):
|
def delete_subscribe(self, del_items: dict[int, int]):
|
||||||
"""删除订阅"""
|
"""删除订阅"""
|
||||||
|
subscribeoper = SubscribeOper()
|
||||||
for subscribe_id in del_items.keys():
|
for subscribe_id in del_items.keys():
|
||||||
try:
|
try:
|
||||||
if subscribe := self.subscribeoper.get(subscribe_id):
|
if subscribe := subscribeoper.get(subscribe_id):
|
||||||
self.subscribeoper.delete(subscribe_id)
|
subscribeoper.delete(subscribe_id)
|
||||||
SubscribeHelper().sub_done_async(
|
SubscribeHelper().sub_done_async(
|
||||||
{"tmdbid": subscribe.tmdbid, "doubanid": subscribe.doubanid}
|
{"tmdbid": subscribe.tmdbid, "doubanid": subscribe.doubanid}
|
||||||
)
|
)
|
||||||
@@ -1030,4 +1030,3 @@ class BangumiColl(_PluginBase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"获取订阅历史失败: {str(e)}")
|
logger.error(f"获取订阅历史失败: {str(e)}")
|
||||||
return set()
|
return set()
|
||||||
|
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ class ContractCheck(_PluginBase):
|
|||||||
|
|
||||||
class ContractInfo:
|
class ContractInfo:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
site_name: str = "",
|
site_name: str = "",
|
||||||
official: bool = False,
|
official: bool = False,
|
||||||
size: int = 0,
|
size: int = 0,
|
||||||
num: int = 0,
|
num: int = 0,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
date: datetime = datetime.now(),
|
date: datetime = datetime.now(),
|
||||||
):
|
):
|
||||||
self.site_name: str = site_name
|
self.site_name: str = site_name
|
||||||
self.official: bool = official
|
self.official: bool = official
|
||||||
@@ -69,8 +69,6 @@ class ContractCheck(_PluginBase):
|
|||||||
self.date: datetime = date
|
self.date: datetime = date
|
||||||
|
|
||||||
# 私有属性
|
# 私有属性
|
||||||
sites = None
|
|
||||||
siteoper = None
|
|
||||||
statistic_sites: list = []
|
statistic_sites: list = []
|
||||||
contract_infos: list[ContractInfo] = []
|
contract_infos: list[ContractInfo] = []
|
||||||
_scheduler: Optional[BackgroundScheduler] = None
|
_scheduler: Optional[BackgroundScheduler] = None
|
||||||
@@ -87,8 +85,7 @@ class ContractCheck(_PluginBase):
|
|||||||
_dashboard_type: str = "brief"
|
_dashboard_type: str = "brief"
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
self.sites = SitesHelper()
|
|
||||||
self.siteoper = SiteOper()
|
|
||||||
# 停止现有任务
|
# 停止现有任务
|
||||||
self.stop_service()
|
self.stop_service()
|
||||||
# 配置
|
# 配置
|
||||||
@@ -123,8 +120,7 @@ class ContractCheck(_PluginBase):
|
|||||||
self._scheduler.add_job(
|
self._scheduler.add_job(
|
||||||
self.refresh_all_site_data,
|
self.refresh_all_site_data,
|
||||||
"date",
|
"date",
|
||||||
run_date=datetime.now(tz=pytz.timezone(settings.TZ))
|
run_date=datetime.now(tz=pytz.timezone(settings.TZ)) + timedelta(seconds=3),
|
||||||
+ timedelta(seconds=3),
|
|
||||||
)
|
)
|
||||||
# 关闭一次性开关
|
# 关闭一次性开关
|
||||||
self._onlyonce = False
|
self._onlyonce = False
|
||||||
@@ -162,7 +158,7 @@ class ContractCheck(_PluginBase):
|
|||||||
self.statistic_sites.append(site_id)
|
self.statistic_sites.append(site_id)
|
||||||
|
|
||||||
def _get_site_id(self, name):
|
def _get_site_id(self, name):
|
||||||
all_sites = [site for site in self.siteoper.list_order_by_pri()] + [
|
all_sites = [site for site in SiteOper().list_order_by_pri()] + [
|
||||||
site for site in self.__custom_sites()
|
site for site in self.__custom_sites()
|
||||||
]
|
]
|
||||||
for site in all_sites:
|
for site in all_sites:
|
||||||
@@ -505,9 +501,7 @@ class ContractCheck(_PluginBase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_dashboard(
|
def get_dashboard(self, **kwargs) -> Optional[Tuple[Dict[str, Any], Dict[str, Any], List[dict]]]:
|
||||||
self,
|
|
||||||
) -> Optional[Tuple[Dict[str, Any], Dict[str, Any], List[dict]]]:
|
|
||||||
"""
|
"""
|
||||||
获取插件仪表盘页面,需要返回:1、仪表板col配置字典;2、全局配置(自动刷新等);3、仪表板页面元素配置json(含数据)
|
获取插件仪表盘页面,需要返回:1、仪表板col配置字典;2、全局配置(自动刷新等);3、仪表板页面元素配置json(含数据)
|
||||||
1、col配置参考:
|
1、col配置参考:
|
||||||
@@ -783,7 +777,7 @@ class ContractCheck(_PluginBase):
|
|||||||
i = html_text.find("window.location")
|
i = html_text.find("window.location")
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return None
|
return None
|
||||||
tmp_url = url + html_text[i : html_text.find(";")].replace(
|
tmp_url = url + html_text[i: html_text.find(";")].replace(
|
||||||
'"', ""
|
'"', ""
|
||||||
).replace("+", "").replace(" ", "").replace(
|
).replace("+", "").replace(" ", "").replace(
|
||||||
"window.location=", ""
|
"window.location=", ""
|
||||||
@@ -793,8 +787,8 @@ class ContractCheck(_PluginBase):
|
|||||||
).get_res(url=tmp_url)
|
).get_res(url=tmp_url)
|
||||||
if res and res.status_code == 200:
|
if res and res.status_code == 200:
|
||||||
if (
|
if (
|
||||||
"charset=utf-8" in res.text
|
"charset=utf-8" in res.text
|
||||||
or "charset=UTF-8" in res.text
|
or "charset=UTF-8" in res.text
|
||||||
):
|
):
|
||||||
res.encoding = "UTF-8"
|
res.encoding = "UTF-8"
|
||||||
else:
|
else:
|
||||||
@@ -819,7 +813,7 @@ class ContractCheck(_PluginBase):
|
|||||||
).get_res(url=url + "/index.php")
|
).get_res(url=url + "/index.php")
|
||||||
if res and res.status_code == 200:
|
if res and res.status_code == 200:
|
||||||
if re.search(
|
if re.search(
|
||||||
r"charset=\"?utf-8\"?", res.text, re.IGNORECASE
|
r"charset=\"?utf-8\"?", res.text, re.IGNORECASE
|
||||||
):
|
):
|
||||||
res.encoding = "utf-8"
|
res.encoding = "utf-8"
|
||||||
else:
|
else:
|
||||||
@@ -975,7 +969,7 @@ class ContractCheck(_PluginBase):
|
|||||||
"""
|
"""
|
||||||
多线程刷新站点下载上传量,默认间隔6小时
|
多线程刷新站点下载上传量,默认间隔6小时
|
||||||
"""
|
"""
|
||||||
if not self.sites.get_indexers():
|
if not SitesHelper().get_indexers():
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.info("开始刷新站点数据 ...")
|
logger.info("开始刷新站点数据 ...")
|
||||||
@@ -983,8 +977,8 @@ class ContractCheck(_PluginBase):
|
|||||||
with lock:
|
with lock:
|
||||||
|
|
||||||
all_sites = [
|
all_sites = [
|
||||||
site for site in self.sites.get_indexers() if not site.get("public")
|
site for site in SitesHelper().get_indexers() if not site.get("public")
|
||||||
] + self.__custom_sites()
|
] + self.__custom_sites()
|
||||||
# 没有指定站点,默认使用全部站点
|
# 没有指定站点,默认使用全部站点
|
||||||
if not self.statistic_sites:
|
if not self.statistic_sites:
|
||||||
refresh_sites = all_sites
|
refresh_sites = all_sites
|
||||||
|
|||||||
@@ -28,12 +28,11 @@ class CustomIndexer(_PluginBase):
|
|||||||
auth_level = 2
|
auth_level = 2
|
||||||
|
|
||||||
# 私有属性
|
# 私有属性
|
||||||
siteshelper = None
|
|
||||||
_enabled = False
|
_enabled = False
|
||||||
_confstr = ""
|
_confstr = ""
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
self.siteshelper = SitesHelper()
|
|
||||||
# 读取配置
|
# 读取配置
|
||||||
if config:
|
if config:
|
||||||
self._enabled = config.get("enabled")
|
self._enabled = config.get("enabled")
|
||||||
@@ -49,7 +48,7 @@ class CustomIndexer(_PluginBase):
|
|||||||
if not domain or not jsonstr:
|
if not domain or not jsonstr:
|
||||||
continue
|
continue
|
||||||
jsonstr = base64.b64decode(jsonstr).decode('utf-8')
|
jsonstr = base64.b64decode(jsonstr).decode('utf-8')
|
||||||
self.siteshelper.add_indexer(domain, json.loads(jsonstr))
|
SitesHelper().add_indexer(domain, json.loads(jsonstr))
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error(f"自定义索引站点配置错误:{err}")
|
logger.error(f"自定义索引站点配置错误:{err}")
|
||||||
self.systemmessage.put(f"自定义索引站点配置错误:{err}", title="自定义索引站点")
|
self.systemmessage.put(f"自定义索引站点配置错误:{err}", title="自定义索引站点")
|
||||||
|
|||||||
@@ -37,10 +37,8 @@ class DownloadingMsg(_PluginBase):
|
|||||||
_seconds = None
|
_seconds = None
|
||||||
_type = None
|
_type = None
|
||||||
_adminuser = None
|
_adminuser = None
|
||||||
_downloadhis = None
|
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
self._downloadhis = DownloadHistoryOper()
|
|
||||||
# 停止现有任务
|
# 停止现有任务
|
||||||
self.stop_service()
|
self.stop_service()
|
||||||
|
|
||||||
@@ -71,8 +69,9 @@ class DownloadingMsg(_PluginBase):
|
|||||||
if self._type == "user" or self._type == "both":
|
if self._type == "user" or self._type == "both":
|
||||||
user_torrents = {}
|
user_torrents = {}
|
||||||
# 根据正在下载种子hash获取下载历史
|
# 根据正在下载种子hash获取下载历史
|
||||||
|
_downloadhis = DownloadHistoryOper()
|
||||||
for torrent in torrents:
|
for torrent in torrents:
|
||||||
downloadhis = self._downloadhis.get_by_hash(download_hash=torrent.hash)
|
downloadhis = _downloadhis.get_by_hash(download_hash=torrent.hash)
|
||||||
if not downloadhis:
|
if not downloadhis:
|
||||||
logger.warn(f"种子 {torrent.hash} 未获取到MoviePilot下载历史,无法推送下载进度")
|
logger.warn(f"种子 {torrent.hash} 未获取到MoviePilot下载历史,无法推送下载进度")
|
||||||
continue
|
continue
|
||||||
@@ -115,13 +114,14 @@ class DownloadingMsg(_PluginBase):
|
|||||||
messages = []
|
messages = []
|
||||||
index = 1
|
index = 1
|
||||||
channel_value = None
|
channel_value = None
|
||||||
|
_downloadhis = DownloadHistoryOper()
|
||||||
for torrent in torrents:
|
for torrent in torrents:
|
||||||
year = None
|
year = None
|
||||||
name = None
|
name = None
|
||||||
se = None
|
se = None
|
||||||
ep = None
|
ep = None
|
||||||
# 先查询下载记录,没有再识别
|
# 先查询下载记录,没有再识别
|
||||||
downloadhis = self._downloadhis.get_by_hash(download_hash=torrent.hash)
|
downloadhis = _downloadhis.get_by_hash(download_hash=torrent.hash)
|
||||||
if downloadhis:
|
if downloadhis:
|
||||||
name = downloadhis.title
|
name = downloadhis.title
|
||||||
year = downloadhis.year
|
year = downloadhis.year
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ from app.utils.common import retry
|
|||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.db.models import PluginData
|
from app.db.models import PluginData
|
||||||
|
|
||||||
|
|
||||||
class ExistMediaInfo(BaseModel):
|
class ExistMediaInfo(BaseModel):
|
||||||
# 季, 集
|
# 季, 集
|
||||||
groupep: Optional[Dict[int, list]] = {}
|
groupep: Optional[Dict[int, list]] = {}
|
||||||
@@ -522,7 +523,7 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
@@ -628,7 +629,7 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
time.sleep(int(self._delay))
|
time.sleep(int(self._delay))
|
||||||
# 开始处理
|
# 开始处理
|
||||||
if self.start_rt(mediainfo=mediainfo, episode_groups=episode_groups):
|
if self.start_rt(mediainfo=mediainfo, episode_groups=episode_groups):
|
||||||
# 处理完成时, 属于自动匹配的, 发送通知
|
# 处理完成时, 属于自动匹配的, 发送通知
|
||||||
if self._notify and mediainfo_dict:
|
if self._notify and mediainfo_dict:
|
||||||
self.post_message(
|
self.post_message(
|
||||||
mtype=schemas.NotificationType.Manual,
|
mtype=schemas.NotificationType.Manual,
|
||||||
@@ -673,8 +674,10 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
self.log_warn(f"{mediainfo.title_year} 在媒体库 {server} 中没有数据")
|
self.log_warn(f"{mediainfo.title_year} 在媒体库 {server} 中没有数据")
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
self.log_info(f"{mediainfo.title_year} 在媒体库 {existsinfo.server} 中找到了这些季集:{existsinfo.groupep}")
|
self.log_info(
|
||||||
_bool = self.__start_rt_mediaserver(mediainfo=mediainfo, existsinfo=existsinfo, episode_groups=episode_groups, group_id=group_id)
|
f"{mediainfo.title_year} 在媒体库 {existsinfo.server} 中找到了这些季集:{existsinfo.groupep}")
|
||||||
|
_bool = self.__start_rt_mediaserver(mediainfo=mediainfo, existsinfo=existsinfo,
|
||||||
|
episode_groups=episode_groups, group_id=group_id)
|
||||||
relust_bool = relust_bool or _bool
|
relust_bool = relust_bool or _bool
|
||||||
else:
|
else:
|
||||||
# v2版本 遍历所有媒体服务器的方式
|
# v2版本 遍历所有媒体服务器的方式
|
||||||
@@ -696,8 +699,11 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
self.log_warn(f"{mediainfo.title_year} 在 ({info.type}){name} 媒体服务器中没有数据")
|
self.log_warn(f"{mediainfo.title_year} 在 ({info.type}){name} 媒体服务器中没有数据")
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
self.log_info(f"{mediainfo.title_year} 在媒体库 ({existsinfo.server_type}){existsinfo.server} 中找到了这些季集:{existsinfo.groupep}")
|
self.log_info(
|
||||||
_bool = self.__start_rt_mediaserver(mediainfo=mediainfo, existsinfo=existsinfo, episode_groups=episode_groups, group_id=group_id, mediaserver_instance=info.instance)
|
f"{mediainfo.title_year} 在媒体库 ({existsinfo.server_type}){existsinfo.server} 中找到了这些季集:{existsinfo.groupep}")
|
||||||
|
_bool = self.__start_rt_mediaserver(mediainfo=mediainfo, existsinfo=existsinfo,
|
||||||
|
episode_groups=episode_groups, group_id=group_id,
|
||||||
|
mediaserver_instance=info.instance)
|
||||||
relust_bool = relust_bool or _bool
|
relust_bool = relust_bool or _bool
|
||||||
return relust_bool
|
return relust_bool
|
||||||
|
|
||||||
@@ -762,7 +768,8 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
ep_num = ep[_index]
|
ep_num = ep[_index]
|
||||||
for _id in _ids:
|
for _id in _ids:
|
||||||
# 获取媒体服务器媒体项
|
# 获取媒体服务器媒体项
|
||||||
iteminfo = self.get_iteminfo(server_type=existsinfo.server_type, itemid=_id, mediaserver_instance=mediaserver_instance)
|
iteminfo = self.get_iteminfo(server_type=existsinfo.server_type, itemid=_id,
|
||||||
|
mediaserver_instance=mediaserver_instance)
|
||||||
if not iteminfo:
|
if not iteminfo:
|
||||||
self.log_info(f"未找到媒体项 - itemid: {_id}, 第 {order} 季, 第 {ep_num} 集")
|
self.log_info(f"未找到媒体项 - itemid: {_id}, 第 {order} 季, 第 {ep_num} 集")
|
||||||
continue
|
continue
|
||||||
@@ -771,7 +778,8 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
if iteminfo.get("LockData") or (
|
if iteminfo.get("LockData") or (
|
||||||
"Name" in iteminfo.get("LockedFields", [])
|
"Name" in iteminfo.get("LockedFields", [])
|
||||||
and "Overview" in iteminfo.get("LockedFields", [])):
|
and "Overview" in iteminfo.get("LockedFields", [])):
|
||||||
self.log_warn(f"已锁定媒体项 - itemid: {_id}, 第 {order} 季, 第 {ep_num} 集, 如果需要刮削请打开设置中的“锁定的剧集也刮削”选项")
|
self.log_warn(
|
||||||
|
f"已锁定媒体项 - itemid: {_id}, 第 {order} 季, 第 {ep_num} 集, 如果需要刮削请打开设置中的“锁定的剧集也刮削”选项")
|
||||||
continue
|
continue
|
||||||
# 替换项目数据
|
# 替换项目数据
|
||||||
episode = episodes[ep_num - 1]
|
episode = episodes[ep_num - 1]
|
||||||
@@ -789,7 +797,8 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
self.__append_to_list(new_dict["LockedFields"], "Name")
|
self.__append_to_list(new_dict["LockedFields"], "Name")
|
||||||
self.__append_to_list(new_dict["LockedFields"], "Overview")
|
self.__append_to_list(new_dict["LockedFields"], "Overview")
|
||||||
# 更新数据
|
# 更新数据
|
||||||
self.set_iteminfo(server_type=existsinfo.server_type, itemid=_id, iteminfo=new_dict, mediaserver_instance=mediaserver_instance)
|
self.set_iteminfo(server_type=existsinfo.server_type, itemid=_id, iteminfo=new_dict,
|
||||||
|
mediaserver_instance=mediaserver_instance)
|
||||||
# still_path 图片
|
# still_path 图片
|
||||||
if episode.get("still_path"):
|
if episode.get("still_path"):
|
||||||
self.set_item_image(server_type=existsinfo.server_type, itemid=_id,
|
self.set_item_image(server_type=existsinfo.server_type, itemid=_id,
|
||||||
@@ -812,7 +821,8 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
if item not in list:
|
if item not in list:
|
||||||
list.append(item)
|
list.append(item)
|
||||||
|
|
||||||
def __media_exists(self, mediainfo: schemas.MediaInfo, server: str, server_type: str, mediaserver_instance: Any = None) -> ExistMediaInfo:
|
def __media_exists(self, mediainfo: schemas.MediaInfo, server: str, server_type: str,
|
||||||
|
mediaserver_instance: Any = None) -> ExistMediaInfo:
|
||||||
"""
|
"""
|
||||||
根据媒体信息,返回是否存在于指定媒体服务器中,剧集列表与剧集ID列表
|
根据媒体信息,返回是否存在于指定媒体服务器中,剧集列表与剧集ID列表
|
||||||
:param mediainfo: 媒体信息
|
:param mediainfo: 媒体信息
|
||||||
@@ -825,14 +835,14 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
try:
|
try:
|
||||||
instance = mediaserver_instance or self.emby
|
instance = mediaserver_instance or self.emby
|
||||||
res = instance.get_data(("[HOST]emby/Items?"
|
res = instance.get_data(("[HOST]emby/Items?"
|
||||||
"IncludeItemTypes=Series"
|
"IncludeItemTypes=Series"
|
||||||
"&Fields=ProductionYear"
|
"&Fields=ProductionYear"
|
||||||
"&StartIndex=0"
|
"&StartIndex=0"
|
||||||
"&Recursive=true"
|
"&Recursive=true"
|
||||||
"&SearchTerm=%s"
|
"&SearchTerm=%s"
|
||||||
"&Limit=10"
|
"&Limit=10"
|
||||||
"&IncludeSearchTypes=false"
|
"&IncludeSearchTypes=false"
|
||||||
"&api_key=[APIKEY]") % mediainfo.title)
|
"&api_key=[APIKEY]") % mediainfo.title)
|
||||||
res_items = res.json().get("Items")
|
res_items = res.json().get("Items")
|
||||||
if res_items:
|
if res_items:
|
||||||
for res_item in res_items:
|
for res_item in res_items:
|
||||||
@@ -893,9 +903,9 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
try:
|
try:
|
||||||
instance = mediaserver_instance or self.jellyfin
|
instance = mediaserver_instance or self.jellyfin
|
||||||
res = instance.get_data(url=f"[HOST]Users/[USER]/Items?api_key=[APIKEY]"
|
res = instance.get_data(url=f"[HOST]Users/[USER]/Items?api_key=[APIKEY]"
|
||||||
f"&searchTerm={mediainfo.title}"
|
f"&searchTerm={mediainfo.title}"
|
||||||
f"&IncludeItemTypes=Series"
|
f"&IncludeItemTypes=Series"
|
||||||
f"&Limit=10&Recursive=true")
|
f"&Limit=10&Recursive=true")
|
||||||
res_items = res.json().get("Items")
|
res_items = res.json().get("Items")
|
||||||
if res_items:
|
if res_items:
|
||||||
for res_item in res_items:
|
for res_item in res_items:
|
||||||
@@ -958,14 +968,14 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
return None
|
return None
|
||||||
# 根据标题和年份模糊搜索,该结果不够准确
|
# 根据标题和年份模糊搜索,该结果不够准确
|
||||||
videos = _plex.library.search(title=mediainfo.title,
|
videos = _plex.library.search(title=mediainfo.title,
|
||||||
year=mediainfo.year,
|
year=mediainfo.year,
|
||||||
libtype="show")
|
libtype="show")
|
||||||
if (not videos
|
if (not videos
|
||||||
and mediainfo.original_title
|
and mediainfo.original_title
|
||||||
and str(mediainfo.original_title) != str(mediainfo.title)):
|
and str(mediainfo.original_title) != str(mediainfo.title)):
|
||||||
videos = _plex.library.search(title=mediainfo.original_title,
|
videos = _plex.library.search(title=mediainfo.original_title,
|
||||||
year=mediainfo.year,
|
year=mediainfo.year,
|
||||||
libtype="show")
|
libtype="show")
|
||||||
if not videos:
|
if not videos:
|
||||||
return None
|
return None
|
||||||
if isinstance(videos, list):
|
if isinstance(videos, list):
|
||||||
@@ -1323,7 +1333,7 @@ class EpisodeGroupMeta(_PluginBase):
|
|||||||
self.jellyfin = Jellyfin()
|
self.jellyfin = Jellyfin()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
services = self.mediaserver_helper.get_services(type_filter=type_filter)#, name_filters=self._mediaservers)
|
services = self.mediaserver_helper.get_services(type_filter=type_filter) #, name_filters=self._mediaservers)
|
||||||
if not services:
|
if not services:
|
||||||
self.log_warn("获取媒体服务器实例失败,请检查配置")
|
self.log_warn("获取媒体服务器实例失败,请检查配置")
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|||||||
from apscheduler.triggers.cron import CronTrigger
|
from apscheduler.triggers.cron import CronTrigger
|
||||||
|
|
||||||
from app.chain.download import DownloadChain
|
from app.chain.download import DownloadChain
|
||||||
from app.chain.search import SearchChain
|
|
||||||
from app.chain.subscribe import SubscribeChain
|
from app.chain.subscribe import SubscribeChain
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.event import Event
|
from app.core.event import Event
|
||||||
@@ -49,9 +48,6 @@ class NeoDBSync(_PluginBase):
|
|||||||
|
|
||||||
_scheduler: Optional[BackgroundScheduler] = None
|
_scheduler: Optional[BackgroundScheduler] = None
|
||||||
_cache_path: Optional[Path] = None
|
_cache_path: Optional[Path] = None
|
||||||
downloadchain = None
|
|
||||||
searchchain = None
|
|
||||||
subscribechain = None
|
|
||||||
|
|
||||||
# 配置属性
|
# 配置属性
|
||||||
_enabled: bool = False
|
_enabled: bool = False
|
||||||
@@ -64,9 +60,6 @@ class NeoDBSync(_PluginBase):
|
|||||||
_tokens: str = ""
|
_tokens: str = ""
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
self.downloadchain = DownloadChain()
|
|
||||||
self.searchchain = SearchChain()
|
|
||||||
self.subscribechain = SubscribeChain()
|
|
||||||
|
|
||||||
# 停止现有任务
|
# 停止现有任务
|
||||||
self.stop_service()
|
self.stop_service()
|
||||||
@@ -510,6 +503,8 @@ class NeoDBSync(_PluginBase):
|
|||||||
logger.info(f"用户 {username} 没有想看数据")
|
logger.info(f"用户 {username} 没有想看数据")
|
||||||
continue
|
continue
|
||||||
# 遍历该用户的所有想看条目
|
# 遍历该用户的所有想看条目
|
||||||
|
downloadchain = DownloadChain()
|
||||||
|
subscribechain = SubscribeChain()
|
||||||
for result in results:
|
for result in results:
|
||||||
try:
|
try:
|
||||||
# Take the url as the unique identifier. For example: /movie/2fEdnxYWozPayayizQmk5M
|
# Take the url as the unique identifier. For example: /movie/2fEdnxYWozPayayizQmk5M
|
||||||
@@ -539,19 +534,19 @@ class NeoDBSync(_PluginBase):
|
|||||||
logger.warn(f'未识别到媒体信息,标题:{title}')
|
logger.warn(f'未识别到媒体信息,标题:{title}')
|
||||||
continue
|
continue
|
||||||
# 查询缺失的媒体信息
|
# 查询缺失的媒体信息
|
||||||
exist_flag, no_exists = self.downloadchain.get_no_exists_info(meta=meta, mediainfo=mediainfo)
|
exist_flag, no_exists = downloadchain.get_no_exists_info(meta=meta, mediainfo=mediainfo)
|
||||||
if exist_flag:
|
if exist_flag:
|
||||||
logger.info(f'{mediainfo.title_year} 媒体库中已存在')
|
logger.info(f'{mediainfo.title_year} 媒体库中已存在')
|
||||||
else:
|
else:
|
||||||
# 添加订阅
|
# 添加订阅
|
||||||
logger.info(f'{mediainfo.title_year} 媒体库中不存在或不完整,添加订阅 ...')
|
logger.info(f'{mediainfo.title_year} 媒体库中不存在或不完整,添加订阅 ...')
|
||||||
self.subscribechain.add(title=mediainfo.title,
|
subscribechain.add(title=mediainfo.title,
|
||||||
year=mediainfo.year,
|
year=mediainfo.year,
|
||||||
mtype=mediainfo.type,
|
mtype=mediainfo.type,
|
||||||
tmdbid=mediainfo.tmdb_id,
|
tmdbid=mediainfo.tmdb_id,
|
||||||
season=meta.begin_season,
|
season=meta.begin_season,
|
||||||
exist_ok=True,
|
exist_ok=True,
|
||||||
username="NeoDB 想看")
|
username="NeoDB 想看")
|
||||||
action = "subscribe"
|
action = "subscribe"
|
||||||
# 存储历史记录
|
# 存储历史记录
|
||||||
history.append({
|
history.append({
|
||||||
|
|||||||
@@ -139,14 +139,12 @@ class RemoveLink(_PluginBase):
|
|||||||
_delete_scrap_infos = False
|
_delete_scrap_infos = False
|
||||||
_delete_torrents = False
|
_delete_torrents = False
|
||||||
_delete_history = False
|
_delete_history = False
|
||||||
_transferhistory = None
|
|
||||||
_observer = []
|
_observer = []
|
||||||
# 监控目录的文件列表
|
# 监控目录的文件列表
|
||||||
state_set: Dict[str, int] = {}
|
state_set: Dict[str, int] = {}
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
logger.info(f"Hello, RemoveLink! config {config}")
|
logger.info(f"Hello, RemoveLink! config {config}")
|
||||||
self._transferhistory = TransferHistoryOper()
|
|
||||||
if config:
|
if config:
|
||||||
self._enabled = config.get("enabled")
|
self._enabled = config.get("enabled")
|
||||||
self._notify = config.get("notify")
|
self._notify = config.get("notify")
|
||||||
@@ -491,10 +489,11 @@ class RemoveLink(_PluginBase):
|
|||||||
if not self._delete_history:
|
if not self._delete_history:
|
||||||
return
|
return
|
||||||
# 查找历史记录
|
# 查找历史记录
|
||||||
transfer_history = self._transferhistory.get_by_src(path)
|
_transferhistory = TransferHistoryOper()
|
||||||
|
transfer_history = _transferhistory.get_by_src(path)
|
||||||
if transfer_history:
|
if transfer_history:
|
||||||
# 删除历史记录
|
# 删除历史记录
|
||||||
self._transferhistory.delete(transfer_history.id)
|
_transferhistory.delete(transfer_history.id)
|
||||||
logger.info(f"删除历史记录:{transfer_history.id}")
|
logger.info(f"删除历史记录:{transfer_history.id}")
|
||||||
|
|
||||||
def delete_empty_folders(self, path):
|
def delete_empty_folders(self, path):
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ class SiteRefresh(_PluginBase):
|
|||||||
# 可使用的用户级别
|
# 可使用的用户级别
|
||||||
auth_level = 2
|
auth_level = 2
|
||||||
|
|
||||||
# 私有属性
|
|
||||||
siteoper: SiteOper = None
|
|
||||||
|
|
||||||
# 配置属性
|
# 配置属性
|
||||||
_enabled: bool = False
|
_enabled: bool = False
|
||||||
_notify: bool = False
|
_notify: bool = False
|
||||||
@@ -42,7 +39,7 @@ class SiteRefresh(_PluginBase):
|
|||||||
_siteconf: list = []
|
_siteconf: list = []
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
self.siteoper = SiteOper()
|
|
||||||
# 配置
|
# 配置
|
||||||
if config:
|
if config:
|
||||||
self._enabled = config.get("enabled")
|
self._enabled = config.get("enabled")
|
||||||
@@ -70,7 +67,7 @@ class SiteRefresh(_PluginBase):
|
|||||||
logger.error(f"未获取到site_id")
|
logger.error(f"未获取到site_id")
|
||||||
return
|
return
|
||||||
|
|
||||||
site = self.siteoper.get(site_id)
|
site = SiteOper().get(site_id)
|
||||||
if not site:
|
if not site:
|
||||||
logger.error(f"未获取到site_id {site_id} 对应的站点数据")
|
logger.error(f"未获取到site_id {site_id} 对应的站点数据")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user