From 544057f7e2103263df768b71d3c06dfa847095d7 Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 9 Jul 2024 11:38:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A2=9E=E5=BC=BA=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- package.json | 3 ++- plugins/filesoftlink/__init__.py | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3c1e55e..60937c0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/ - [自定义命令 v1.7](docs%2FCustomCommand.md) - docker自定义任务 v1.3 - 插件彻底卸载 v1.0 -- 实时软连接 v1.9.4 +- 实时软连接 v1.9.5 - 订阅规则自动填充 v2.7 - Emby元数据刷新 v1.3 - Emby媒体标签 v1.2 diff --git a/package.json b/package.json index b42953d..13e0d75 100644 --- a/package.json +++ b/package.json @@ -388,11 +388,12 @@ "name": "实时软连接", "description": "监控目录文件变化,媒体文件软连接,其他文件可选复制。", "labels": "文件管理", - "version": "1.9.4", + "version": "1.9.5", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png", "author": "thsrite", "level": 1, "history": { + "v1.9.5": "增强交互命令", "v1.9.4": "监控目录自定义监控模式", "v1.9.3": "增强交互命令模糊匹配", "v1.9.2": "增强交互命令模糊匹配", diff --git a/plugins/filesoftlink/__init__.py b/plugins/filesoftlink/__init__.py index 6aa8805..65ddd9a 100644 --- a/plugins/filesoftlink/__init__.py +++ b/plugins/filesoftlink/__init__.py @@ -52,7 +52,7 @@ class FileSoftLink(_PluginBase): # 插件图标 plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png" # 插件版本 - plugin_version = "1.9.4" + plugin_version = "1.9.5" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -306,6 +306,7 @@ class FileSoftLink(_PluginBase): mon_path = mon break + # 指定路径软连接 if mon_path: if not Path(args).exists(): logger.info(f"同步路径 {args} 不存在") @@ -322,6 +323,22 @@ class FileSoftLink(_PluginBase): self.post_message(channel=event.event_data.get("channel"), title=f"{args} 软连接完成!", userid=event.event_data.get("user")) return + else: + for mon_path in self._categoryconf.keys(): + mon_category = self._categoryconf.get(mon_path) + logger.info(f"开始检查 {mon_path} {mon_category}") + if mon_category and str(args) in mon_category: + parent_path = os.path.join(mon_path, args) + logger.info(f"获取到 {args} 对应的监控目录 {parent_path}") + for sroot, sdirs, sfiles in os.walk(parent_path): + for file_name in sdirs + sfiles: + src_file = os.path.join(sroot, file_name) + if Path(src_file).is_file(): + self.__handle_file(event_path=str(src_file), mon_path=mon_path) + if event: + self.post_message(channel=event.event_data.get("channel"), + title=f"{args} 软连接完成!", + userid=event.event_data.get("user")) def sync_all(self): """