From 253739f48b33f0fb721930123019cd7461f1b280 Mon Sep 17 00:00:00 2001 From: thsrite Date: Fri, 21 Jun 2024 20:51:05 +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.4=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=A0=BC=E5=BC=8F?= 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 | 37 ++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 99e6828..4fbc177 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.3 +- 实时软连接 v1.4 - 订阅规则自动填充 v2.7 - Emby元数据刷新 v1.1 - Emby媒体标签 v1.2 diff --git a/package.json b/package.json index d2c0011..8a433ef 100644 --- a/package.json +++ b/package.json @@ -378,11 +378,12 @@ "name": "实时软连接", "description": "监控目录文件变化,媒体文件软连接,其他文件可选复制。", "labels": "文件管理", - "version": "1.3", + "version": "1.4", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png", "author": "thsrite", "level": 1, "history": { + "v1.4": "支持自定义视频格式", "v1.3": "异步启动" } }, diff --git a/plugins/filesoftlink/__init__.py b/plugins/filesoftlink/__init__.py index 0464def..6a4789c 100644 --- a/plugins/filesoftlink/__init__.py +++ b/plugins/filesoftlink/__init__.py @@ -19,7 +19,7 @@ from app.core.config import settings from app.core.event import eventmanager, Event from app.log import logger from app.plugins import _PluginBase -from app.schemas.types import EventType, MediaType, SystemConfigKey +from app.schemas.types import EventType, SystemConfigKey from app.utils.system import SystemUtils lock = threading.Lock() @@ -52,7 +52,7 @@ class FileSoftLink(_PluginBase): # 插件图标 plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png" # 插件版本 - plugin_version = "1.3" + plugin_version = "1.4" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -79,6 +79,9 @@ class FileSoftLink(_PluginBase): # 存储源目录与目的目录关系 _dirconf: Dict[str, Optional[Path]] = {} _medias = {} + + _rmt_mediaext = ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v" + # 退出事件 _event = threading.Event() @@ -96,6 +99,8 @@ class FileSoftLink(_PluginBase): self._exclude_keywords = config.get("exclude_keywords") or "" self._cron = config.get("cron") self._size = config.get("size") or 0 + self._rmt_mediaext = config.get( + "rmt_mediaext") or ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v" # 停止现有任务 self.stop_service() @@ -328,7 +333,8 @@ class FileSoftLink(_PluginBase): os.makedirs(Path(target_file).parent) # 媒体文件软连接 - if Path(target_file).suffix in settings.RMT_MEDIAEXT: + if Path(target_file).suffix.lower() not in [ext.strip() for ext in + self._rmt_mediaext.split(",")]: retcode, retmsg = SystemUtils.softlink(file_path, Path(target_file)) logger.info(f"创建媒体文件软连接 {str(file_path)} 到 {target_file} {retcode} {retmsg}") else: @@ -556,6 +562,28 @@ class FileSoftLink(_PluginBase): } ] }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12 + }, + 'content': [ + { + 'component': 'VTextarea', + 'props': { + 'model': 'rmt_mediaext', + 'label': '视频格式', + 'rows': 2, + 'placeholder': ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v" + } + } + ] + } + ] + }, { 'component': 'VRow', 'content': [ @@ -587,7 +615,8 @@ class FileSoftLink(_PluginBase): "monitor_dirs": "", "exclude_keywords": "", "cron": "", - "size": 0 + "size": 0, + "rmt_mediaext": ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v" } def get_page(self) -> List[dict]: