fix 更新系统
This commit is contained in:
parent
21908bdc6f
commit
44b7199087
@ -59,13 +59,11 @@ class SystemChain(ChainBase, metaclass=Singleton):
|
|||||||
"userid": userid
|
"userid": userid
|
||||||
}, self._update_file)
|
}, self._update_file)
|
||||||
|
|
||||||
|
# 更新系统
|
||||||
|
if not settings.MOVIEPILOT_AUTO_UPDATE:
|
||||||
|
os.system("cd / && bash /usr/local/bin/mp_update")
|
||||||
# 重启系统
|
# 重启系统
|
||||||
os.system("bash /usr/local/bin/mp_update")
|
SystemUtils.restart()
|
||||||
|
|
||||||
if channel and userid:
|
|
||||||
self.post_message(Notification(channel=channel,
|
|
||||||
title="暂无新版本!", userid=userid))
|
|
||||||
self.remove_cache(self._update_file)
|
|
||||||
|
|
||||||
def version(self, channel: MessageChannel, userid: Union[int, str]):
|
def version(self, channel: MessageChannel, userid: Union[int, str]):
|
||||||
"""
|
"""
|
||||||
|
@ -450,7 +450,7 @@ class DoubanSync(_PluginBase):
|
|||||||
url = self._interests_url % user_id
|
url = self._interests_url % user_id
|
||||||
results = self.rsshelper.parse(url)
|
results = self.rsshelper.parse(url)
|
||||||
if not results:
|
if not results:
|
||||||
logger.error(f"未获取到用户 {user_id} 豆瓣RSS数据:{url}")
|
logger.warn(f"未获取到用户 {user_id} 豆瓣RSS数据:{url}")
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
logger.info(f"获取到用户 {user_id} 豆瓣RSS数据:{len(results)}")
|
logger.info(f"获取到用户 {user_id} 豆瓣RSS数据:{len(results)}")
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import datetime
|
||||||
|
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from apscheduler.triggers.cron import CronTrigger
|
from apscheduler.triggers.cron import CronTrigger
|
||||||
|
|
||||||
@ -81,18 +83,21 @@ class MoviePilotUpdateNotify(_PluginBase):
|
|||||||
|
|
||||||
# 本地版本
|
# 本地版本
|
||||||
local_version = SystemChain().get_local_version()
|
local_version = SystemChain().get_local_version()
|
||||||
if release_version == local_version:
|
if local_version and release_version <= local_version:
|
||||||
logger.info(f"当前版本:{local_version} 远程版本:{release_version} 停止运行")
|
logger.info(f"当前版本:{local_version} 远程版本:{release_version} 停止运行")
|
||||||
return
|
return
|
||||||
|
|
||||||
# 推送更新消息
|
# 推送更新消息
|
||||||
if self._notify:
|
if self._notify:
|
||||||
|
# 将时间字符串转为datetime对象
|
||||||
|
update_time = datetime.datetime.strptime(update_time, "%Y-%m-%dT%H:%M:%SZ").strftime("%Y-%m-%d %H:%M:%S")
|
||||||
self.post_message(
|
self.post_message(
|
||||||
mtype=NotificationType.SiteMessage,
|
mtype=NotificationType.SiteMessage,
|
||||||
title="【MoviePilot更新通知】",
|
title="【MoviePilot更新通知】",
|
||||||
text=f"{release_version} \n"
|
text=f"{release_version} \n"
|
||||||
f"\n"
|
f"\n"
|
||||||
f"{description} \n"
|
f"{description} \n"
|
||||||
|
f"\n"
|
||||||
f"{update_time}")
|
f"{update_time}")
|
||||||
|
|
||||||
# 自动更新
|
# 自动更新
|
||||||
@ -131,91 +136,91 @@ class MoviePilotUpdateNotify(_PluginBase):
|
|||||||
拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构
|
拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构
|
||||||
"""
|
"""
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'component': 'VForm',
|
'component': 'VForm',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
'md': 4
|
'md': 4
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VSwitch',
|
'component': 'VSwitch',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'enabled',
|
'model': 'enabled',
|
||||||
'label': '启用插件',
|
'label': '启用插件',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
'md': 4
|
'md': 4
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VSwitch',
|
'component': 'VSwitch',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'update',
|
'model': 'update',
|
||||||
'label': '自动更新',
|
'label': '自动更新',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
'md': 4
|
'md': 4
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VSwitch',
|
'component': 'VSwitch',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'notify',
|
'model': 'notify',
|
||||||
'label': '发送通知',
|
'label': '发送通知',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VTextField',
|
'component': 'VTextField',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'cron',
|
'model': 'cron',
|
||||||
'label': '检查周期',
|
'label': '检查周期',
|
||||||
'placeholder': '5位cron表达式'
|
'placeholder': '5位cron表达式'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
], {
|
], {
|
||||||
"enabled": False,
|
"enabled": False,
|
||||||
"update": False,
|
"update": False,
|
||||||
"notify": False,
|
"notify": False,
|
||||||
"cron": "0 9 * * *"
|
"cron": "0 9 * * *"
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_page(self) -> List[dict]:
|
def get_page(self) -> List[dict]:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user