From 7d9a3d39b32033747a222eb2485edc8e7a382c8d Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 19 Oct 2023 18:09:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=9B=B4=E6=96=B0=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moviepilotupdatenotify/__init__.py | 176 +++++++++--------- 1 file changed, 90 insertions(+), 86 deletions(-) diff --git a/app/plugins/moviepilotupdatenotify/__init__.py b/app/plugins/moviepilotupdatenotify/__init__.py index 8336e0c1..b088c77f 100644 --- a/app/plugins/moviepilotupdatenotify/__init__.py +++ b/app/plugins/moviepilotupdatenotify/__init__.py @@ -1,3 +1,5 @@ +import datetime + from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.cron import CronTrigger @@ -81,12 +83,14 @@ class MoviePilotUpdateNotify(_PluginBase): # 本地版本 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} 停止运行") return # 推送更新消息 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( mtype=NotificationType.SiteMessage, title="【MoviePilot更新通知】", @@ -131,91 +135,91 @@ class MoviePilotUpdateNotify(_PluginBase): 拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构 """ return [ - { - 'component': 'VForm', - 'content': [ - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 4 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'enabled', - 'label': '启用插件', - } - } - ] - }, - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 4 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'update', - 'label': '自动更新', - } - } - ] - }, - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 4 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'notify', - 'label': '发送通知', - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VTextField', - 'props': { - 'model': 'cron', - 'label': '检查周期', - 'placeholder': '5位cron表达式' - } - } - ] - }, - ] - } - ] - } - ], { - "enabled": False, - "update": False, - "notify": False, - "cron": "0 9 * * *" - } + { + 'component': 'VForm', + 'content': [ + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'enabled', + 'label': '启用插件', + } + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'update', + 'label': '自动更新', + } + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'notify', + 'label': '发送通知', + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VTextField', + 'props': { + 'model': 'cron', + 'label': '检查周期', + 'placeholder': '5位cron表达式' + } + } + ] + }, + ] + } + ] + } + ], { + "enabled": False, + "update": False, + "notify": False, + "cron": "0 9 * * *" + } def get_page(self) -> List[dict]: pass