fix Emby观影报告 v1.7

分块发送,兼容微信推送
This commit is contained in:
thsrite
2024-09-14 12:41:58 +08:00
parent e16fb9685b
commit 5299bf002d
3 changed files with 8 additions and 52 deletions

View File

@@ -19,13 +19,3 @@
![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,12 +204,11 @@
"name": "Emby观影报告",
"description": "推送Emby观影报告需Emby安装Playback Report 插件。",
"labels": "Emby",
"version": "1.7.1",
"version": "1.8",
"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.1"
plugin_version = "1.7"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -56,7 +56,6 @@ class EmbyReporter(_PluginBase):
_mp_host = None
_emby_host = None
_emby_api_key = None
_text_url = None
show_time = True
_scheduler: Optional[BackgroundScheduler] = None
@@ -82,7 +81,6 @@ 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:
@@ -160,29 +158,17 @@ class EmbyReporter(_PluginBase):
self.__split_image_by_height(report_path, "/public/report", [250, 330, 335])
# 分块推送
for i in range(1, 4):
report_path_part = report_path + f"_part_{i}.jpg"
for i in range(2, 4):
report_path_part = f"/public/report_part_{i}.jpg"
report_url = self._mp_host + report_path_part.replace("/public", "")
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,
text=report_text)
logger.info(f"Emby观影记录推送成功")
self.post_message(title='Movies观影排行' if i == 2 else 'TV Shows观影排行',
mtype=mtype,
image=report_url)
logger.info(f"Emby观影记录推送成功 {report_url}")
@staticmethod
def __split_image_by_height(image_path, output_path_prefix, heights):
@@ -230,7 +216,6 @@ 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,
@@ -441,23 +426,6 @@ class EmbyReporter(_PluginBase):
}
]
},
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 6
},
'content': [
{
'component': 'VTextField',
'props': {
'model': 'text_url',
'label': '每日一言api',
'placeholder': '空则不发送'
}
}
]
}
]
},
{
@@ -553,7 +521,6 @@ class EmbyReporter(_PluginBase):
"emby_api_key": "",
"mp_host": "",
"show_time": True,
"text_url": "",
"type": ""
}