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}")
|
||||||
|
|
||||||
# 自动更新
|
# 自动更新
|
||||||
|
Loading…
x
Reference in New Issue
Block a user