fix 清除历史记录

This commit is contained in:
thsrite
2024-04-08 13:38:54 +08:00
parent 9e23980dee
commit ef5eeefd56
4 changed files with 35 additions and 8 deletions

View File

@@ -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)

View File

@@ -2,6 +2,7 @@
### 更新记录
- 1.3 清除历史记录
- 1.2 增加执行历史
- 1.1 打印命令日志
- 1.0 自定义执行周期执行命令并推送结果

View File

@@ -154,7 +154,7 @@
"CustomCommand": {
"name": "自定义命令",
"description": "自定义执行周期执行命令并推送结果。",
"version": "1.2",
"version": "1.3",
"icon": "Ntfy_A.png",
"author": "thsrite",
"level": 1

View File

@@ -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": ""
}