From 3b71f583a6c1a59c9aa4677b14114ba126db4bbf Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 25 Jun 2024 16:19:10 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=BA=91=E7=9B=98=E5=8A=A9=E6=89=8Bv2.0?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E9=80=9A=E7=9F=A5=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- package.json | 3 ++- plugins/cloudassistant/__init__.py | 22 ++++++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a0f1a8b..b9f3a80 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/ - 目录监控(统一入库消息增强版) v1.0 - Sql执行器 v1.2 - 命令执行器 v1.2 -- 云盘助手(docs%2FCloudAssistant.md) v1.9 +- 云盘助手(docs%2FCloudAssistant.md) v2.0 - CloudDrive2助手 v1.2 - 软连接重定向 v1.0 - 云盘同步删除 v1.1 \ No newline at end of file diff --git a/package.json b/package.json index 6249ff5..8e32d80 100644 --- a/package.json +++ b/package.json @@ -521,11 +521,12 @@ "name": "云盘助手", "description": "本地文件定时转移到云盘,软连接/strm回本地,定时清理无效软连接。", "labels": "云盘", - "version": "1.8", + "version": "2.0", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/cloudassistant.png", "author": "thsrite", "level": 3, "history": { + "v2.0": "调整通知图片", "v1.9": "修复非媒体文件转移bug(需要主程序1.9.9+)", "v1.8": "支持可选开启实时监控", "v1.7": "转移完成发送消息通知(插件类型消息)", diff --git a/plugins/cloudassistant/__init__.py b/plugins/cloudassistant/__init__.py index 34f2e58..a8d0af3 100644 --- a/plugins/cloudassistant/__init__.py +++ b/plugins/cloudassistant/__init__.py @@ -27,7 +27,7 @@ from app.db.transferhistory_oper import TransferHistoryOper from app.log import logger from app.modules.emby import Emby from app.plugins import _PluginBase -from app.schemas.types import EventType, SystemConfigKey, MediaType, NotificationType +from app.schemas.types import EventType, SystemConfigKey, MediaType, NotificationType, MediaImageType from app.utils.http import RequestUtils from app.utils.string import StringUtils from app.utils.system import SystemUtils @@ -64,7 +64,7 @@ class CloudAssistant(_PluginBase): # 插件图标 plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/cloudassistant.png" # 插件版本 - plugin_version = "1.9" + plugin_version = "2.0" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -623,6 +623,20 @@ class CloudAssistant(_PluginBase): } """ key = f"{transferhis.title} ({transferhis.year})" + + # 获取图片 + try: + backrop_image = self.chain.obtain_specific_image( + mediaid=transferhis.tmdbid, + mtype=MediaType(transferhis.type), + image_type=MediaImageType.Backdrop, + season=int(transferhis.seasons.replace("S", "")) if transferhis.seasons else None, + episode=int(transferhis.episodes.replace("E", "")) if transferhis.episodes else None, + ) or transferhis.image + except Exception as e: + logger.error(f"获取图片失败 {str(e)} 使用转移记录图片") + backrop_image = transferhis.image + # 发送消息汇总 media_list = self._medias.get( key + " " + transferhis.seasons) or {} @@ -637,7 +651,7 @@ class CloudAssistant(_PluginBase): "key": key, "mtype": transferhis.type, "category": transferhis.category, - "image": transferhis.image, + "image": backrop_image, "season": transferhis.seasons, "episodes": episodes, "time": datetime.datetime.now() @@ -647,7 +661,7 @@ class CloudAssistant(_PluginBase): "key": key, "mtype": transferhis.type, "category": transferhis.category, - "image": transferhis.image, + "image": backrop_image, "season": transferhis.seasons, "episodes": [transferhis.episodes.replace("E", "")], "time": datetime.datetime.now()