fix Emby观影报告 v1.7.1

分块发送,带每日一言
This commit is contained in:
thsrite
2024-09-14 12:27:32 +08:00
parent fc0137d4d2
commit e16fb9685b
3 changed files with 50 additions and 3 deletions

View File

@@ -18,3 +18,14 @@
![img.png](../img/EmbyReporter/img.png)
![img_1.png](../img/EmbyReporter/img_1.png)
每日一言推荐
``
https://v.api.aa1.cn/api/yiyan/index.php
https://yijuzhan.com/api/word.php
``
点点推荐舔狗
``
https://v.api.aa1.cn/api/tiangou/index.php
``

View File

@@ -204,11 +204,12 @@
"name": "Emby观影报告",
"description": "推送Emby观影报告需Emby安装Playback Report 插件。",
"labels": "Emby",
"version": "1.7",
"version": "1.7.1",
"icon": "Pydiocells_A.png",
"author": "thsrite",
"level": 1,
"history": {
"v1.7.1": "分块发送,带每日一言",
"v1.7": "分块发送,兼容微信推送",
"v1.6": "fix #67",
"v1.5": "按观影市场排序",

View File

@@ -33,7 +33,7 @@ class EmbyReporter(_PluginBase):
# 插件图标
plugin_icon = "Pydiocells_A.png"
# 插件版本
plugin_version = "1.7"
plugin_version = "1.7.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -56,6 +56,7 @@ class EmbyReporter(_PluginBase):
_mp_host = None
_emby_host = None
_emby_api_key = None
_text_url = None
show_time = True
_scheduler: Optional[BackgroundScheduler] = None
@@ -81,6 +82,7 @@ class EmbyReporter(_PluginBase):
self._type = config.get("type") or "tg"
self._mp_host = config.get("mp_host")
self.show_time = config.get("show_time")
self._text_url = config.get("text_url")
self._emby_host = config.get("emby_host")
self._emby_api_key = config.get("emby_api_key")
if self._emby_host and self._emby_api_key:
@@ -164,8 +166,22 @@ class EmbyReporter(_PluginBase):
mtype = NotificationType.MediaServer
if self._type:
mtype = NotificationType.__getitem__(str(self._type)) or NotificationType.MediaServer
# 每日一言
report_text = None
if self._text_url:
try:
resp = RequestUtils().get_res(url=self._text_url)
if resp.status_code == 200:
report_text = resp.text
if report_text:
report_text = str(report_text).replace("<p>", "").replace("</p>", "")
except Exception as e:
print(e)
self.post_message(mtype=mtype,
image=report_url)
image=report_url,
text=report_text)
logger.info(f"Emby观影记录推送成功")
@staticmethod
@@ -214,6 +230,7 @@ class EmbyReporter(_PluginBase):
"cnt": self._cnt,
"type": self._type,
"mp_host": self._mp_host,
"text_url": self._text_url,
"show_time": self.show_time,
"emby_host": self._emby_host,
"emby_api_key": self._emby_api_key,
@@ -424,6 +441,23 @@ class EmbyReporter(_PluginBase):
}
]
},
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 6
},
'content': [
{
'component': 'VTextField',
'props': {
'model': 'text_url',
'label': '每日一言api',
'placeholder': '空则不发送'
}
}
]
}
]
},
{
@@ -519,6 +553,7 @@ class EmbyReporter(_PluginBase):
"emby_api_key": "",
"mp_host": "",
"show_time": True,
"text_url": "",
"type": ""
}