From 637cf9e83a20d714e9caac2268690dfe7e570eff Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 28 May 2025 20:01:26 +0800 Subject: [PATCH] fix https://github.com/jxxghp/MoviePilot-Plugins/issues/784 --- package.v2.json | 3 ++- plugins.v2/moviepilotupdatenotify/__init__.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.v2.json b/package.v2.json index e2b628c..bb3d819 100644 --- a/package.v2.json +++ b/package.v2.json @@ -345,11 +345,12 @@ "name": "MoviePilot更新推送", "description": "MoviePilot推送release更新通知、自动重启。", "labels": "消息通知,自动更新", - "version": "2.1", + "version": "2.2", "icon": "Moviepilot_A.png", "author": "thsrite", "level": 1, "history": { + "v2.2": "支持 MoviePilot v2.5.0+", "v2.1": "优化执行周期输入,需要MoviePilot v2.2.1+", "v2.0": "兼容MoviePilot V2" } diff --git a/plugins.v2/moviepilotupdatenotify/__init__.py b/plugins.v2/moviepilotupdatenotify/__init__.py index 05866a3..3125c44 100644 --- a/plugins.v2/moviepilotupdatenotify/__init__.py +++ b/plugins.v2/moviepilotupdatenotify/__init__.py @@ -1,5 +1,6 @@ import datetime import re +from typing import Any, List, Dict, Tuple, Optional import pytz from apscheduler.schedulers.background import BackgroundScheduler @@ -7,12 +8,11 @@ from apscheduler.triggers.cron import CronTrigger from app.chain.system import SystemChain from app.core.config import settings -from app.plugins import _PluginBase -from typing import Any, List, Dict, Tuple, Optional +from app.helper.system import SystemHelper from app.log import logger +from app.plugins import _PluginBase from app.schemas import NotificationType from app.utils.http import RequestUtils -from app.utils.system import SystemUtils class MoviePilotUpdateNotify(_PluginBase): @@ -23,7 +23,7 @@ class MoviePilotUpdateNotify(_PluginBase): # 插件图标 plugin_icon = "Moviepilot_A.png" # 插件版本 - plugin_version = "2.1" + plugin_version = "2.2" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -70,7 +70,7 @@ class MoviePilotUpdateNotify(_PluginBase): # 自动重启 if (server_update or front_update) and self._restart: logger.info("开始执行自动重启…") - SystemUtils.restart() + SystemHelper.restart() def __check_server_update(self): """ @@ -165,7 +165,7 @@ class MoviePilotUpdateNotify(_PluginBase): logger.error("无法获取版本信息,请检查网络连接或GitHub API请求。") return None - def __get_backend_latest(self) -> Tuple[str, str, str]: + def __get_backend_latest(self) -> Tuple[Optional[str], Optional[str], Optional[str]]: """ 获取最新版本 """