From f635c8c8bd3edda19e9e6dfb4e68c8163d7c10f2 Mon Sep 17 00:00:00 2001 From: thsrite Date: Sat, 13 Apr 2024 13:05:40 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=81=94=E5=8A=A8=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=90=8C=E5=90=8D=E9=9D=9E=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- package.json | 3 ++- plugins/cloudstrm/__init__.py | 20 +++++++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 100c453..53e9337 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/ - 站点数据统计 1.4 (无未读消息版本)(废弃) - 站点未读消息 1.4 -- [云盘Strm生成 4.0](docs%2FCloudStrm.md) +- [云盘Strm生成 4.1](docs%2FCloudStrm.md) - [Strm文件模式转换 1.0](docs%2FStrmConvert.md) - 清理订阅缓存 1.0 - 添加种子下载 1.0 diff --git a/package.json b/package.json index 14c777a..2edc376 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,12 @@ "CloudStrm": { "name": "云盘Strm生成", "description": "监控文件创建,生成Strm文件。", - "version": "4.0", + "version": "4.1", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/create.png", "author": "thsrite", "level": 1, "history": { + "v4.1": "联动同时处理同名非媒体文件", "v4.0": "fix replace", "v3.9": "修复bug", "v3.8": "支持联动其他转移插件", diff --git a/plugins/cloudstrm/__init__.py b/plugins/cloudstrm/__init__.py index 246429f..4a67196 100644 --- a/plugins/cloudstrm/__init__.py +++ b/plugins/cloudstrm/__init__.py @@ -26,7 +26,7 @@ class CloudStrm(_PluginBase): # 插件图标 plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/create.png" # 插件版本 - plugin_version = "4.0" + plugin_version = "4.1" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -316,9 +316,11 @@ class CloudStrm(_PluginBase): source_file = str(event_data.get("transferinfo").target_path) logger.info(f"收到命令,开始处理单个文件 {source_file} ...") if source_file: - self.__strm(source_file) + # 云盘文件json新增 + self.__cloud_files.append(source_file) + self.__strm(source_file, True) - def __strm(self, source_file): + def __strm(self, source_file: str, linkage: bool = False): """ 生成strm文件 """ @@ -367,6 +369,18 @@ class CloudStrm(_PluginBase): cloud_type=cloud_type, cloud_path=cloud_path, cloud_url=cloud_url) + # 联动的时候,同步处理同名非媒体文件 + if linkage and self._copy_files: + # 查询其他文件 + pattern = Path(source_file).stem.replace('[', '?').replace(']', '?') + logger.info(f"开始处理同名文件 {pattern}") + other_files = Path(source_file).parent.glob(f"{pattern}.*") + for file in other_files: + # 云盘文件json新增 + self.__cloud_files.append(file) + # 其他nfo、jpg等复制文件 + shutil.copy2(file, dest_file) + logger.info(f"复制其他文件 {file} 到 {dest_file}") else: if self._copy_files: # 其他nfo、jpg等复制文件