This commit is contained in:
thsrite
2024-04-02 12:55:28 +08:00
parent 980b4c2f30
commit cf30b8055e
4 changed files with 6 additions and 7 deletions

View File

@@ -29,5 +29,5 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
- [源文件恢复 1.2](docs%2FLinkToSrc.md)
- [微信消息转发 1.3](docs%2FWeChatForward.md)
- [订阅下载统计 1.5](docs%2FSubscribeStatistic.md)
- [自定义命令 1.1](docs%2FCustomCommand.md)
- [自定义命令 1.0](docs%2FCustomCommand.md)

View File

@@ -2,7 +2,6 @@
### 更新记录
- 1.1 试试打印命令日志
- 1.0 自定义执行周期执行命令并推送结果

View File

@@ -154,7 +154,7 @@
"CustomCommand": {
"name": "自定义命令",
"description": "自定义执行周期执行命令并推送结果。",
"version": "1.1",
"version": "1.0",
"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.1"
plugin_version = "1.0"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -108,7 +108,7 @@ class CustomCommand(_PluginBase):
logger.info(f"随机延时 {random_delay}")
time.sleep(random_delay)
result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1)
result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
last_output = None
last_error = None
while True:
@@ -116,14 +116,14 @@ class CustomCommand(_PluginBase):
if output == '' and result.poll() is not None:
break
if output:
print(output.strip())
logger.info(output.strip())
last_output = output.strip()
error = result.stderr.readline().decode("utf-8")
if error == '' and result.poll() is not None:
break
if error:
print(error.strip())
logger.info(error.strip())
last_error = error.strip()
logger.info(