From 6797add73cac0047735f5c02f08db5cefa2ad267 Mon Sep 17 00:00:00 2001 From: ljmeng Date: Sat, 24 Feb 2024 22:41:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A0=A1=E6=AD=A3=E6=97=A0=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E7=A7=8D=E5=AD=90=E7=9A=84=E5=88=A4=E6=96=AD=E6=A0=87?= =?UTF-8?q?=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/torrenttransfer/__init__.py | 79 ++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/plugins/torrenttransfer/__init__.py b/plugins/torrenttransfer/__init__.py index cdfbcc1..701f6eb 100644 --- a/plugins/torrenttransfer/__init__.py +++ b/plugins/torrenttransfer/__init__.py @@ -27,7 +27,7 @@ class TorrentTransfer(_PluginBase): # 插件图标 plugin_icon = "seed.png" # 插件版本 - plugin_version = "1.1" + plugin_version = "1.2" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -59,6 +59,7 @@ class TorrentTransfer(_PluginBase): _deletesource = False _fromtorrentpath = None _autostart = False + _transferemptylabel = False # 退出事件 _event = Event() # 待检查种子清单 @@ -85,6 +86,7 @@ class TorrentTransfer(_PluginBase): self._fromtorrentpath = config.get("fromtorrentpath") self._nopaths = config.get("nopaths") self._autostart = config.get("autostart") + self._transferemptylabel = config.get("transferemptylabel") # 停止现有任务 self.stop_service() @@ -133,7 +135,8 @@ class TorrentTransfer(_PluginBase): "deletesource": self._deletesource, "fromtorrentpath": self._fromtorrentpath, "nopaths": self._nopaths, - "autostart": self._autostart + "autostart": self._autostart, + "transferemptylabel": self._transferemptylabel }) if self._scheduler.get_jobs(): if self._autostart: @@ -172,7 +175,7 @@ class TorrentTransfer(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 6 + 'md': 4 }, 'content': [ { @@ -188,7 +191,7 @@ class TorrentTransfer(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 6 + 'md': 4 }, 'content': [ { @@ -199,6 +202,22 @@ class TorrentTransfer(_PluginBase): } } ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'transferemptylabel', + 'label': '转移无标签种子', + } + } + ] } ] }, @@ -444,7 +463,8 @@ class TorrentTransfer(_PluginBase): "deletesource": False, "fromtorrentpath": "", "nopaths": "", - "autostart": True + "autostart": True, + "transferemptylabel": False } def get_page(self) -> List[dict]: @@ -541,26 +561,37 @@ class TorrentTransfer(_PluginBase): # 获取种子标签 torrent_labels = self.__get_label(torrent, downloader) - # 排除含有不转移的标签 - if torrent_labels and self._nolabels: - is_skip = False - for label in self._nolabels.split(','): - if label in torrent_labels: - logger.info(f"种子 {hash_str} 含有不转移标签 {label},跳过 ...") - is_skip = True - break - if is_skip: - continue - # 排除不含有转移标签的种子 - if torrent_labels and self._includelabels: - is_skip = False - for label in self._includelabels.split(','): - if label not in torrent_labels: - logger.info(f"种子 {hash_str} 不含有转移标签 {label},跳过 ...") - is_skip = True - break - if is_skip: + + # 种子为无标签,则进行规范化 + is_torrent_labels_empty = torrent_labels == [''] or torrent_labels == [] or torrent_labels is None + if is_torrent_labels_empty: + torrent_labels = [] + + #根据设置决定是否转移无标签的种子 + if is_torrent_labels_empty: + if not self._transferemptylabel: continue + else: + # 排除含有不转移的标签 + if self._nolabels: + is_skip = False + for label in self._nolabels.split(','): + if label in torrent_labels: + logger.info(f"种子 {hash_str} 含有不转移标签 {label},跳过 ...") + is_skip = True + break + if is_skip: + continue + # 排除不含有转移标签的种子 + if self._includelabels: + is_skip = False + for label in self._includelabels.split(','): + if label not in torrent_labels: + logger.info(f"种子 {hash_str} 不含有转移标签 {label},跳过 ...") + is_skip = True + break + if is_skip: + continue # 添加转移数据 trans_torrents.append({ From 08a97f9fb707db297a385c597d004c9e8eb47e79 Mon Sep 17 00:00:00 2001 From: ljmeng Date: Sun, 25 Feb 2024 00:15:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 910d546..ac04769 100644 --- a/package.json +++ b/package.json @@ -186,7 +186,7 @@ "TorrentTransfer": { "name": "自动转移做种", "description": "定期转移下载器中的做种任务到另一个下载器。", - "version": "1.1", + "version": "1.2", "icon": "seed.png", "author": "jxxghp", "level": 2