From 41a9797d870cb2d8b7b7727ef2466f7060e23986 Mon Sep 17 00:00:00 2001 From: so1ve Date: Tue, 4 Feb 2025 13:36:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat(torrenttransfer.v2):=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=B7=B3=E8=BF=87=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.v2.json | 3 ++- plugins.v2/torrenttransfer/__init__.py | 37 +++++++++++++++++++++----- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/package.v2.json b/package.v2.json index db3d87b..2c3159f 100644 --- a/package.v2.json +++ b/package.v2.json @@ -104,11 +104,12 @@ "name": "自动转移做种", "description": "定期转移下载器中的做种任务到另一个下载器。", "labels": "做种", - "version": "1.9", + "version": "1.10", "icon": "seed.png", "author": "jxxghp", "level": 2, "history": { + "v1.10": "支持跳过校验(仅支持 qBittorrent),开启跳过校验后需手动开启自动开始", "v1.9": "优化执行周期输入,需要MoviePilot v2.2.1+", "v1.8": "支持qbittorrent 5", "v1.7": "MoviePilot V2 版本自动转移做种插件", diff --git a/plugins.v2/torrenttransfer/__init__.py b/plugins.v2/torrenttransfer/__init__.py index 9beb8f4..ab1e311 100644 --- a/plugins.v2/torrenttransfer/__init__.py +++ b/plugins.v2/torrenttransfer/__init__.py @@ -61,6 +61,7 @@ class TorrentTransfer(_PluginBase): _deleteduplicate = False _fromtorrentpath = None _autostart = False + _skipverify = False _transferemptylabel = False _add_torrent_tags = None # 退出事件 @@ -92,6 +93,7 @@ class TorrentTransfer(_PluginBase): self._fromtorrentpath = config.get("fromtorrentpath") self._nopaths = config.get("nopaths") self._autostart = config.get("autostart") + self._skipverify = config.get("skipverify") self._transferemptylabel = config.get("transferemptylabel") self._add_torrent_tags = config.get("add_torrent_tags") or "" self._torrent_tags = self._add_torrent_tags.strip().split(",") if self._add_torrent_tags else [] @@ -467,6 +469,19 @@ class TorrentTransfer(_PluginBase): } ] }, + { + "component": "VCol", + "props": {"cols": 12, "md": 3}, + "content": [ + { + "component": "VSwitch", + "props": { + "model": "skipverify", + "label": "跳过校验(仅QB有效)", + }, + } + ], + }, { 'component': 'VCol', 'props': { @@ -536,6 +551,7 @@ class TorrentTransfer(_PluginBase): "fromtorrentpath": "", "nopaths": "", "autostart": True, + "skipverify": False, "transferemptylabel": False, "add_torrent_tags": "已整理,转移做种" } @@ -572,7 +588,8 @@ class TorrentTransfer(_PluginBase): state = downloader.add_torrent(content=content, download_dir=save_path, is_paused=True, - tag=self._torrent_tags + [tag]) + tag=self._torrent_tags + [tag], + is_skip_checking=self._skipverify) if not state: return None else: @@ -806,11 +823,19 @@ class TorrentTransfer(_PluginBase): logger.info(f"qbittorrent 开始校验 {download_id} ...") to_downloader.recheck_torrents(ids=[download_id]) - # 追加校验任务 - logger.info(f"添加校验检查任务:{download_id} ...") - if not self._recheck_torrents.get(to_service.name): - self._recheck_torrents[to_service.name] = [] - self._recheck_torrents[to_service.name].append(download_id) + if self._skipverify: + # 跳过校验 + logger.info(f"{download_id} 跳过校验,请自行检查...") + # 请注意这里是故意不自动开始的 + # 跳过校验存在直接失败、种子目录相同文件不同等异常情况 + # 必须要用户自行二次确认之后才能开始做种 + # 否则会出现反复下载刷掉分享率、做假种的情况 + else: + # 追加校验任务 + logger.info(f"添加校验检查任务:{download_id} ...") + if not self._recheck_torrents.get(to_service.name): + self._recheck_torrents[to_service.name] = [] + self._recheck_torrents[to_service.name].append(download_id) # 删除源种子,不能删除文件! if self._deletesource: From 699f00de8a4cd5be1ab2e45038179ea61652739e Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 4 Feb 2025 14:37:01 +0800 Subject: [PATCH 2/5] Update __init__.py --- plugins.v2/torrenttransfer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins.v2/torrenttransfer/__init__.py b/plugins.v2/torrenttransfer/__init__.py index ab1e311..e035c89 100644 --- a/plugins.v2/torrenttransfer/__init__.py +++ b/plugins.v2/torrenttransfer/__init__.py @@ -28,7 +28,7 @@ class TorrentTransfer(_PluginBase): # 插件图标 plugin_icon = "seed.png" # 插件版本 - plugin_version = "1.9" + plugin_version = "1.10" # 插件作者 plugin_author = "jxxghp" # 作者主页 From 2f4df5a77bf67441b8cbff60d0615ad946aa3de3 Mon Sep 17 00:00:00 2001 From: so1ve Date: Tue, 4 Feb 2025 15:02:29 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix(torrenttransfer.v2):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.v2/torrenttransfer/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins.v2/torrenttransfer/__init__.py b/plugins.v2/torrenttransfer/__init__.py index e035c89..e84ed41 100644 --- a/plugins.v2/torrenttransfer/__init__.py +++ b/plugins.v2/torrenttransfer/__init__.py @@ -818,11 +818,6 @@ class TorrentTransfer(_PluginBase): # 下载成功 logger.info(f"成功添加转移做种任务,种子文件:{torrent_file}") - # TR会自动校验,QB需要手动校验 - if self.downloader_helper.is_downloader("qbittorrent", service=to_service): - logger.info(f"qbittorrent 开始校验 {download_id} ...") - to_downloader.recheck_torrents(ids=[download_id]) - if self._skipverify: # 跳过校验 logger.info(f"{download_id} 跳过校验,请自行检查...") @@ -836,6 +831,10 @@ class TorrentTransfer(_PluginBase): if not self._recheck_torrents.get(to_service.name): self._recheck_torrents[to_service.name] = [] self._recheck_torrents[to_service.name].append(download_id) + # TR会自动校验,QB需要手动校验 + if self.downloader_helper.is_downloader("qbittorrent", service=to_service): + logger.info(f"qbittorrent 开始校验 {download_id} ...") + to_downloader.recheck_torrents(ids=[download_id]) # 删除源种子,不能删除文件! if self._deletesource: From 5169d8dea49868a3f52c3a9c3d3834118857573c Mon Sep 17 00:00:00 2001 From: so1ve Date: Tue, 4 Feb 2025 15:22:24 +0800 Subject: [PATCH 4/5] fix: logic --- plugins.v2/torrenttransfer/__init__.py | 37 +++++++++++++++----------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/plugins.v2/torrenttransfer/__init__.py b/plugins.v2/torrenttransfer/__init__.py index e84ed41..5c2637f 100644 --- a/plugins.v2/torrenttransfer/__init__.py +++ b/plugins.v2/torrenttransfer/__init__.py @@ -818,23 +818,21 @@ class TorrentTransfer(_PluginBase): # 下载成功 logger.info(f"成功添加转移做种任务,种子文件:{torrent_file}") - if self._skipverify: - # 跳过校验 - logger.info(f"{download_id} 跳过校验,请自行检查...") - # 请注意这里是故意不自动开始的 - # 跳过校验存在直接失败、种子目录相同文件不同等异常情况 - # 必须要用户自行二次确认之后才能开始做种 - # 否则会出现反复下载刷掉分享率、做假种的情况 + # TR会自动校验,QB需要手动校验 + if self.downloader_helper.is_downloader("qbittorrent", service=to_service): + if self._skipverify: + if self._autostart: + logger.info(f"{download_id} 跳过校验,开启自动开始,注意观察种子的完整性") + self.__add_recheck_torrents(to_service, download_id) + else: + # 跳过校验 + logger.info(f"{download_id} 跳过校验,请自行检查手动开始任务...") + else: + logger.info(f"qbittorrent 开始校验 {download_id} ...") + to_downloader.recheck_torrents(ids=[download_id]) + self.__add_recheck_torrents(to_service, download_id) else: - # 追加校验任务 - logger.info(f"添加校验检查任务:{download_id} ...") - if not self._recheck_torrents.get(to_service.name): - self._recheck_torrents[to_service.name] = [] - self._recheck_torrents[to_service.name].append(download_id) - # TR会自动校验,QB需要手动校验 - if self.downloader_helper.is_downloader("qbittorrent", service=to_service): - logger.info(f"qbittorrent 开始校验 {download_id} ...") - to_downloader.recheck_torrents(ids=[download_id]) + self.__add_recheck_torrents(to_service, download_id) # 删除源种子,不能删除文件! if self._deletesource: @@ -867,6 +865,13 @@ class TorrentTransfer(_PluginBase): logger.info(f"没有需要转移的种子") logger.info("转移做种任务执行完成") + def __add_recheck_torrents(self, service: ServiceInfo, download_id: str): + # 追加校验任务 + logger.info(f"添加校验检查任务:{download_id} ...") + if not self._recheck_torrents.get(service.name): + self._recheck_torrents[service.name] = [] + self._recheck_torrents[service.name].append(download_id) + def check_recheck(self): """ 定时检查下载器中种子是否校验完成,校验完成且完整的自动开始辅种 From 232b11780ebd699018d4c79d7a721046828ad029 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 4 Feb 2025 15:38:10 +0800 Subject: [PATCH 5/5] Update package.v2.json --- package.v2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.v2.json b/package.v2.json index 2c3159f..faa8a7c 100644 --- a/package.v2.json +++ b/package.v2.json @@ -109,7 +109,7 @@ "author": "jxxghp", "level": 2, "history": { - "v1.10": "支持跳过校验(仅支持 qBittorrent),开启跳过校验后需手动开启自动开始", + "v1.10": "支持跳过校验(仅支持 qBittorrent)", "v1.9": "优化执行周期输入,需要MoviePilot v2.2.1+", "v1.8": "支持qbittorrent 5", "v1.7": "MoviePilot V2 版本自动转移做种插件",