diff --git a/README.md b/README.md index 5025b89..be961fe 100644 --- a/README.md +++ b/README.md @@ -29,5 +29,5 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/ - [源文件恢复 1.2](docs%2FLinkToSrc.md) - [微信消息转发 1.5](docs%2FWeChatForward.md) - [订阅下载统计 1.5](docs%2FSubscribeStatistic.md) -- [自定义命令 1.2](docs%2FCustomCommand.md) +- [自定义命令 1.3](docs%2FCustomCommand.md) diff --git a/docs/CustomCommand.md b/docs/CustomCommand.md index 12a7a47..928ffcd 100644 --- a/docs/CustomCommand.md +++ b/docs/CustomCommand.md @@ -2,6 +2,7 @@ ### 更新记录 +- 1.3 清除历史记录 - 1.2 增加执行历史 - 1.1 打印命令日志 - 1.0 自定义执行周期执行命令并推送结果 diff --git a/package.json b/package.json index c9bc78d..561e6ca 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "CustomCommand": { "name": "自定义命令", "description": "自定义执行周期执行命令并推送结果。", - "version": "1.2", + "version": "1.3", "icon": "Ntfy_A.png", "author": "thsrite", "level": 1 diff --git a/plugins/customcommand/__init__.py b/plugins/customcommand/__init__.py index 0d9efd8..a7ad336 100644 --- a/plugins/customcommand/__init__.py +++ b/plugins/customcommand/__init__.py @@ -22,7 +22,7 @@ class CustomCommand(_PluginBase): # 插件图标 plugin_icon = "Ntfy_A.png" # 插件版本 - plugin_version = "1.2" + plugin_version = "1.3" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -38,7 +38,8 @@ class CustomCommand(_PluginBase): _enabled: bool = False _onlyonce: bool = False _notify: bool = False - _msgtype: bool = False + _clear: bool = False + _msgtype: str = None _time_confs = None _scheduler: Optional[BackgroundScheduler] = None @@ -51,8 +52,15 @@ class CustomCommand(_PluginBase): self._onlyonce = config.get("onlyonce") self._notify = config.get("notify") self._msgtype = config.get("msgtype") + self._clear = config.get("clear") self._time_confs = config.get("time_confs") + # 清除历史 + if self._clear: + self.del_data('history') + self._clear = False + self.__update_config() + if (self._enabled or self._onlyonce) and self._time_confs: # 周期运行 self._scheduler = BackgroundScheduler(timezone=settings.TZ) @@ -157,7 +165,8 @@ class CustomCommand(_PluginBase): "onlyonce": self._onlyonce, "notify": self._notify, "msgtype": self._msgtype, - "time_confs": self._time_confs + "time_confs": self._time_confs, + "clear": self._clear }) def get_state(self) -> bool: @@ -192,7 +201,7 @@ class CustomCommand(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 3 + 'md': 2 }, 'content': [ { @@ -208,7 +217,7 @@ class CustomCommand(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 3 + 'md': 2 }, 'content': [ { @@ -224,7 +233,7 @@ class CustomCommand(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 3 + 'md': 2 }, 'content': [ { @@ -236,6 +245,22 @@ class CustomCommand(_PluginBase): } ] }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 2 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'clear', + 'label': '清除历史记录', + } + } + ] + }, { 'component': 'VCol', 'props': { @@ -328,6 +353,7 @@ class CustomCommand(_PluginBase): "enabled": False, "notify": False, "onlyonce": False, + "clear": False, "time_confs": "", "msgtype": "" }