This commit is contained in:
thsrite
2023-08-07 13:03:04 +08:00
parent ce243502c2
commit 76849e11ca
5 changed files with 28 additions and 24 deletions

View File

@ -5,7 +5,7 @@ from datetime import datetime
from app.core.config import settings
from app.plugins import _PluginBase
from app.core.event import eventmanager
from app.schemas.types import EventType
from app.schemas.types import EventType, MessageChannel
from app.utils.http import RequestUtils
from typing import Any, List, Dict, Tuple, Optional
from app.log import logger
@ -13,7 +13,7 @@ from app.log import logger
class MessageForward(_PluginBase):
# 插件名称
plugin_name = "WeChat消息转发"
plugin_name = "消息转发"
# 插件描述
plugin_desc = "根据正则转发通知到其他WeChat应用。"
# 插件图标
@ -107,7 +107,7 @@ class MessageForward(_PluginBase):
'props': {
'model': 'wechat',
'rows': '3',
'label': 'wechat应用配置',
'label': '应用配置',
'placeholder': 'appid:corpid:appsecret一行一个配置'
}
}
@ -130,7 +130,7 @@ class MessageForward(_PluginBase):
'model': 'pattern',
'rows': '3',
'label': '正则配置',
'placeholder': '对应上方wechat配置,一行一个,一一对应'
'placeholder': '对应上方应用配置,一行一个,一一对应'
}
}
]
@ -148,7 +148,7 @@ class MessageForward(_PluginBase):
def get_page(self) -> List[dict]:
pass
@eventmanager.register(EventType.WechatMessage)
@eventmanager.register(EventType.NoticeMessage)
def send(self, event):
"""
消息转发
@ -158,6 +158,10 @@ class MessageForward(_PluginBase):
# 消息体
data = event.event_data
channel = data['channel']
if channel and channel != MessageChannel.Wechat:
return
title = data['title']
text = data['text']
image = data['image']

View File

@ -7,11 +7,11 @@ from typing import Any, List, Dict, Tuple
from app.log import logger
class NastoolsSync(_PluginBase):
class NAStoolSync(_PluginBase):
# 插件名称
plugin_name = "历史记录同步"
# 插件描述
plugin_desc = "同步NasTools历史记录到MoviePilot。"
plugin_desc = "同步NAStool历史记录到MoviePilot。"
# 插件图标
plugin_icon = "sync.png"
# 主题色
@ -163,12 +163,13 @@ class NastoolsSync(_PluginBase):
AND t.TYPE = d.TYPE;'''
cursor.execute(sql)
nt_historys = cursor.fetchall()
cursor.close()
if not nt_historys:
logger.error("未获取到NasTools数据库文件中的转移历史,请检查数据库路径是正确")
logger.error("未获取到NAStool数据库文件中的转移历史请检查数据库路径是正确")
return
logger.info(f"获取到NasTools转移记录 {len(nt_historys)}")
logger.info(f"获取到NAStool转移记录 {len(nt_historys)}")
return nt_historys
def get_state(self) -> bool:
@ -224,7 +225,7 @@ class NastoolsSync(_PluginBase):
'component': 'VTextField',
'props': {
'model': 'nt_db_path',
'label': 'NasTools数据库user.db路径',
'label': 'NAStool数据库user.db路径',
}
}
]
@ -245,7 +246,7 @@ class NastoolsSync(_PluginBase):
'props': {
'model': 'path',
'label': '路径映射',
'placeholder': 'NasTools路径:MoviePilot路径一行一个'
'placeholder': 'NAStool路径:MoviePilot路径一行一个'
}
}
]