From f9b5b2bb7c5b54baef8677935bd017d8320f6bf2 Mon Sep 17 00:00:00 2001 From: honue Date: Thu, 15 Feb 2024 14:38:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=89=A7=E5=90=8D=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- plugins/downloadsitetag/__init__.py | 35 ++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index d0a5084..7fd1df7 100644 --- a/package.json +++ b/package.json @@ -338,7 +338,7 @@ "DownloadSiteTag": { "name": "下载任务分类与标签", "description": "自动给下载任务分类与打站点标签", - "version": "1.1", + "version": "1.2", "icon": "Youtube-dl_B.png", "author": "叮叮当", "level": 1 diff --git a/plugins/downloadsitetag/__init__.py b/plugins/downloadsitetag/__init__.py index 60b3d17..4e78332 100644 --- a/plugins/downloadsitetag/__init__.py +++ b/plugins/downloadsitetag/__init__.py @@ -18,7 +18,7 @@ class DownloadSiteTag(_PluginBase): # 插件图标 plugin_icon = "Youtube-dl_B.png" # 插件版本 - plugin_version = "1.1" + plugin_version = "1.2" # 插件作者 plugin_author = "叮叮当" # 作者主页 @@ -34,6 +34,7 @@ class DownloadSiteTag(_PluginBase): downloader_name = None downloader_example = None _enabled = False + _enabled_media_tag = False _enabled_tag = True _enabled_category = False _category_movie = None @@ -44,6 +45,7 @@ class DownloadSiteTag(_PluginBase): # 读取配置 if config: self._enabled = config.get("enabled") + self._enabled_media_tag = config.get("enabled_media_tag") self._enabled_tag = config.get("enabled_tag") self._enabled_category = config.get("enabled_category") self._category_movie = config.get("category_movie") or "电影" @@ -93,6 +95,9 @@ class DownloadSiteTag(_PluginBase): # 设置标签, 如果勾选开关的话 if self._enabled_tag: self.downloader_example.set_torrents_tag(ids=_hash, tags=[_torrent.site_name]) + # 设置媒体标题标签, 如果勾选开关的话 + if self._enabled_media_tag: + self.downloader_example.set_torrents_tag(ids=_hash, tags=[_media.title]) # 设置分类, 如果勾选开关的话 if self._enabled_category: if _media.type == MediaType.MOVIE: @@ -114,8 +119,11 @@ class DownloadSiteTag(_PluginBase): # 设置标签, 如果勾选开关的话 if self._enabled_tag: self.downloader_example.set_torrent_tag(ids=_hash, tags=[_torrent.site_name]) + # 设置媒体标题标签, 如果勾选开关的话 + if self._enabled_media_tag: + self.downloader_example.set_torrent_tag(ids=_hash, tags=[_media.title]) logger.warn( - f"[DownloadSiteTag] 当前下载器: {self.downloader_name}{(' TAG: ' + _torrent.site_name) if self._enabled_tag else ''}{(' CAT: ' + _media_type) if _media_type else ''}") + f"[DownloadSiteTag] 当前下载器: {self.downloader_name}{(' TAG: ' + _torrent.site_name) if self._enabled_tag else ''}{(' MEDIA_TAG: ' + _media.title) if self._enabled_media_tag else ''}{(' CAT: ' + _media_type) if _media_type else ''}") def get_form(self) -> Tuple[List[dict], Dict[str, Any]]: """ @@ -132,7 +140,7 @@ class DownloadSiteTag(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 4 + 'md': 3 }, 'content': [ { @@ -148,7 +156,7 @@ class DownloadSiteTag(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 4 + 'md': 3 }, 'content': [ { @@ -164,7 +172,23 @@ class DownloadSiteTag(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 4 + 'md': 3 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'enabled_media_tag', + 'label': '自动剧名标签', + } + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 3 }, 'content': [ { @@ -288,6 +312,7 @@ class DownloadSiteTag(_PluginBase): ], { "enabled": False, "enabled_tag": True, + "enabled_media_tag": False, "enabled_category": False, "category_movie": "电影", "category_tv": "电视",