From e0931123de35c35c9cdbf42915cd9a8d5273d791 Mon Sep 17 00:00:00 2001 From: thsrite Date: Wed, 23 Oct 2024 13:01:10 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=A7=BB=E9=99=A4CloudLinkMonitor?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=EF=BC=8C=E5=8F=AF=E7=94=A8v2=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E8=AE=BE=E7=BD=AE=E6=9B=BF=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.v2.json | 31 --------- plugins.v2/cloudlinkmonitor/__init__.py | 85 ++++--------------------- 2 files changed, 11 insertions(+), 105 deletions(-) diff --git a/package.v2.json b/package.v2.json index 350c1e0..26cc8c4 100644 --- a/package.v2.json +++ b/package.v2.json @@ -1,35 +1,4 @@ { - "CloudLinkMonitor": { - "name": "云盘实时监控", - "description": "监控云盘目录文件变化,自动转移链接。", - "labels": "云盘", - "version": "2.4.6", - "icon": "Linkease_A.png", - "author": "thsrite", - "level": 1, - "history": { - "v2.4.6": "修复bug", - "v2.4.5": "联动实时软连接插件(近媒体文件)", - "v2.4.4": "修复刷新媒体库", - "v2.4.3": "可选转移完刷新媒体库", - "v2.4.2": "fix #65", - "v2.4.1": "增加log", - "v2.4": "修复二级目录", - "v2.3": "去除无效变量", - "v2.2": "优化配置一二级分类流程", - "v2.1": "可配置是否存储转移记录", - "v2.0": "修复不刮削不生效bug", - "v1.8": "fix S00转移", - "v1.7": "fix 刮削", - "v1.6": "可配置是否刮削", - "v1.5": "fix 消息推送", - "v1.4": "fix 转移后路径", - "v1.3": "修复bug", - "v1.2": "修复订阅重复处理的bug", - "v1.1": "自动转移链接(不刮削)", - "v1.0": "监控云盘目录文件变化,按原文件名软连接" - } - }, "EmbyMetaRefresh": { "name": "Emby元数据刷新", "description": "定时刷新Emby媒体库元数据,演职人员中文。", diff --git a/plugins.v2/cloudlinkmonitor/__init__.py b/plugins.v2/cloudlinkmonitor/__init__.py index 815db8e..d0d9dd3 100644 --- a/plugins.v2/cloudlinkmonitor/__init__.py +++ b/plugins.v2/cloudlinkmonitor/__init__.py @@ -84,7 +84,6 @@ class CloudLinkMonitor(_PluginBase): _onlyonce = False _history = False _scrape = False - _category = False _refresh = False _softlink = False _cron = None @@ -104,7 +103,6 @@ class CloudLinkMonitor(_PluginBase): _medias = {} # 退出事件 _event = threading.Event() - _auto_category = False def init_plugin(self, config: dict = None): self.transferhis = TransferHistoryOper() @@ -115,7 +113,6 @@ class CloudLinkMonitor(_PluginBase): # 清空配置 self._dirconf = {} self._transferconf = {} - self._categoryconf = {} # 读取配置 if config: @@ -124,7 +121,6 @@ class CloudLinkMonitor(_PluginBase): self._onlyonce = config.get("onlyonce") self._history = config.get("history") self._scrape = config.get("scrape") - self._category = config.get("category") self._refresh = config.get("refresh") self._mode = config.get("mode") self._transfer_type = config.get("transfer_type") @@ -133,7 +129,6 @@ class CloudLinkMonitor(_PluginBase): self._interval = config.get("interval") or 10 self._cron = config.get("cron") self._size = config.get("size") or 0 - self._auto_category = config.get("auto_category") self._softlink = config.get("softlink") # 停止现有任务 @@ -155,12 +150,6 @@ class CloudLinkMonitor(_PluginBase): if not mon_path: continue - # 是否二级目录 默认False - _categroy = self._category - if mon_path.count("$") == 1: - _categroy = True if mon_path.split("$")[1] == "True" else False - mon_path = mon_path.split("$")[0] - # 自定义转移方式 _transfer_type = self._transfer_type if mon_path.count("#") == 1: @@ -188,7 +177,6 @@ class CloudLinkMonitor(_PluginBase): # 转移方式 self._transferconf[mon_path] = _transfer_type - self._categoryconf[mon_path] = _categroy # 启用目录监控 if self._enabled: @@ -260,12 +248,10 @@ class CloudLinkMonitor(_PluginBase): "exclude_keywords": self._exclude_keywords, "interval": self._interval, "history": self._history, - "category": self._category, "softlink": self._softlink, "scrape": self._scrape, "size": self._size, "refresh": self._refresh, - "auto_category": self._auto_category }) @eventmanager.register(EventType.PluginAction) @@ -387,7 +373,6 @@ class CloudLinkMonitor(_PluginBase): target: Path = self._dirconf.get(mon_path) # 查询转移方式 transfer_type = self._transferconf.get(mon_path) - category = self._categoryconf.get(mon_path) file_item = FileItem() file_item.path = file_path @@ -424,27 +409,14 @@ class CloudLinkMonitor(_PluginBase): else: episodes_info = None - if self._auto_category: - # 转移文件 - transferinfo: TransferInfo = self.filetransfer.transfer(fileitem=file_item, - meta=file_meta, - mediainfo=mediainfo, - transfer_type=transfer_type, - target_path=target, - episodes_info=episodes_info, - scrape=self._scrape) - else: - if category and mediainfo.category: - target = target / mediainfo.category - - # 转移文件 - transferinfo: TransferInfo = self.filetransfer.transfer_media(fileitem=file_item, - in_meta=file_meta, - mediainfo=mediainfo, - transfer_type=transfer_type, - target_path=target, - episodes_info=episodes_info, - need_scrape=self._scrape) + # 转移文件 + transferinfo: TransferInfo = self.filetransfer.transfer(fileitem=file_item, + meta=file_meta, + mediainfo=mediainfo, + transfer_type=transfer_type, + target_storage="local", + episodes_info=episodes_info, + scrape=self._scrape) if not transferinfo: logger.error("文件转移模块运行失败") @@ -806,9 +778,9 @@ class CloudLinkMonitor(_PluginBase): { 'component': 'VSwitch', 'props': { - 'model': 'category', - 'label': '二级目录', - } + 'model': 'softlink', + 'label': '联动实时软连接', + }, } ] } @@ -822,23 +794,6 @@ class CloudLinkMonitor(_PluginBase): { 'component': 'VRow', 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 4 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'auto_category', - 'label': '启用媒体库目录', - }, - 'hint': '使用媒体库配置目录' - } - ] - }, { 'component': 'VCol', 'props': { @@ -855,22 +810,6 @@ class CloudLinkMonitor(_PluginBase): } ] }, - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 4 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'softlink', - 'label': '联动实时软连接', - }, - } - ] - } ] } ] @@ -1058,9 +997,7 @@ class CloudLinkMonitor(_PluginBase): "onlyonce": False, "history": False, "scrape": False, - "category": False, "refresh": True, - "auto_category": False, "softlink": False, "mode": "fast", "transfer_type": "filesoftlink",