From bb4b9ee56faa111a83228ea71111dd84312024fa Mon Sep 17 00:00:00 2001 From: thsrite Date: Fri, 21 Jun 2024 21:01:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=AE=9E=E6=97=B6=E8=BD=AF=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5v1.5=E4=BC=98=E5=8C=96=E6=80=A7=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E9=AB=98=E5=A4=84=E7=90=86=E9=80=9F=E5=BA=A6?= 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 | 7 +++++-- plugins/filesoftlink/__init__.py | 12 ++++++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4fbc177..40b6e39 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.4 +- 实时软连接 v1.5 - 订阅规则自动填充 v2.7 - Emby元数据刷新 v1.1 - Emby媒体标签 v1.2 diff --git a/package.json b/package.json index 8a433ef..c495059 100644 --- a/package.json +++ b/package.json @@ -378,11 +378,12 @@ "name": "实时软连接", "description": "监控目录文件变化,媒体文件软连接,其他文件可选复制。", "labels": "文件管理", - "version": "1.4", + "version": "1.5", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png", "author": "thsrite", "level": 1, "history": { + "v1.5": "优化性能,提高处理速度", "v1.4": "支持自定义视频格式", "v1.3": "异步启动" } diff --git a/plugins/cloudassistant/__init__.py b/plugins/cloudassistant/__init__.py index c4b5985..8de2191 100644 --- a/plugins/cloudassistant/__init__.py +++ b/plugins/cloudassistant/__init__.py @@ -288,8 +288,11 @@ class CloudAssistant(_PluginBase): # 遍历所有监控目录 for mon_path in self._dirconf.keys(): # 遍历目录下所有文件 - for file_path in SystemUtils.list_files(Path(mon_path), [".*"]): - self.__handle_file(event_path=str(file_path), mon_path=mon_path) + for root, dirs, files in os.walk(mon_path): + for name in dirs + files: + path = os.path.join(root, name) + if Path(path).is_file(): + self.__handle_file(event_path=str(path), mon_path=mon_path) logger.info("云盘助手全量同步监控目录完成!") def event_handler(self, event, mon_path: str, text: str, event_path: str): diff --git a/plugins/filesoftlink/__init__.py b/plugins/filesoftlink/__init__.py index 6a4789c..4822c2f 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.4" + plugin_version = "1.5" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -218,7 +218,8 @@ class FileSoftLink(_PluginBase): "monitor_dirs": self._monitor_dirs, "exclude_keywords": self._exclude_keywords, "cron": self._cron, - "size": self._size + "size": self._size, + "rmt_mediaext": self._rmt_mediaext }) @eventmanager.register(EventType.PluginAction) @@ -246,8 +247,11 @@ class FileSoftLink(_PluginBase): # 遍历所有监控目录 for mon_path in self._dirconf.keys(): # 遍历目录下所有文件 - for file_path in SystemUtils.list_files(Path(mon_path), ['.*']): - self.__handle_file(event_path=str(file_path), mon_path=mon_path) + for root, dirs, files in os.walk(mon_path): + for name in dirs + files: + path = os.path.join(root, name) + if Path(path).is_file(): + self.__handle_file(event_path=str(path), mon_path=mon_path) logger.info("全量同步监控目录完成!") def event_handler(self, event, mon_path: str, text: str, event_path: str):