From f97b5f701e8b1542d1b2299c93a3bfbe86660a66 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 11 Apr 2024 16:07:43 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=94=AF=E6=8C=81=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E8=BD=AC=E7=A7=BB=E6=8F=92=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 | 38 +++++++++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9b61cf0..5bedf3f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/ - 站点数据统计 1.4 (无未读消息版本)(废弃) - 站点未读消息 1.4 -- [云盘Strm生成 3.7](docs%2FCloudStrm.md) +- [云盘Strm生成 3.8](docs%2FCloudStrm.md) - [Strm文件模式转换 1.0](docs%2FStrmConvert.md) - 清理订阅缓存 1.0 - 添加种子下载 1.0 diff --git a/package.json b/package.json index 8d5134e..462dc57 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,12 @@ "CloudStrm": { "name": "云盘Strm生成", "description": "监控文件创建,生成Strm文件。", - "version": "3.7", + "version": "3.8", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/create.png", "author": "thsrite", "level": 1, "history": { + "v3.8": "支持联动其他转移插件", "v3.7": "api模式支持启用https", "v3.6": "支持重建索引周期运行", "v3.4": "交互命令", diff --git a/plugins/cloudstrm/__init__.py b/plugins/cloudstrm/__init__.py index 48d0db5..fa4124f 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 = "3.7" + plugin_version = "3.8" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -47,6 +47,7 @@ class CloudStrm(_PluginBase): _copy_files = False _rebuild = False _https = False + _linkage = False _observer = [] _video_formats = ('.mp4', '.avi', '.rmvb', '.wmv', '.mov', '.mkv', '.flv', '.ts', '.webm', '.iso', '.mpg', '.m2ts') __cloud_files_json = "cloud_files.json" @@ -77,6 +78,7 @@ class CloudStrm(_PluginBase): self._onlyonce = config.get("onlyonce") self._rebuild = config.get("rebuild") self._https = config.get("https") + self._linkage = config.get("linkage") self._copy_files = config.get("copy_files") self._monitor_confs = config.get("monitor_confs") @@ -302,9 +304,23 @@ class CloudStrm(_PluginBase): file.write(json.dumps(self.__cloud_files)) file.close() + @eventmanager.register(EventType.TransferComplete) + def _linkage_strm(self, event: Event = None): + """ + 联动生成strm文件 + """ + if self._linkage and event: + event_data = event.event_data + if not event_data or not event_data.get("transferinfo"): + return + source_file = event_data.get("transferinfo").path + logger.info(f"收到命令,开始处理单个文件 {source_file} ...") + if source_file: + self.__strm(source_file) + def __strm(self, source_file): """ - 判断文件是否有对应strm + 生成strm文件 """ try: # 获取文件的转移路径 @@ -430,6 +446,7 @@ class CloudStrm(_PluginBase): "rebuild": self._rebuild, "copy_files": self._copy_files, "https": self._https, + "linkage": self._linkage, "cron": self._cron, "monitor_confs": self._monitor_confs }) @@ -634,6 +651,22 @@ class CloudStrm(_PluginBase): } ] }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'linkage', + 'label': '联动其他转移插件', + } + } + ] + }, ] }, { @@ -735,6 +768,7 @@ class CloudStrm(_PluginBase): "rebuild": False, "copy_files": False, "https": False, + "linkage": False, "monitor_confs": "" }