From 36986995a485150b7d7e5fa518981de808d5743c Mon Sep 17 00:00:00 2001 From: chenkun Date: Wed, 22 Jan 2025 16:44:03 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E6=A0=A1=E9=AA=8C=E5=90=8E=EF=BC=8Cqb?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=99=A8=E4=B8=8D=E8=87=AA=E5=8A=A8=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.v2.json | 3 ++- plugins.v2/iyuuautoseed/__init__.py | 18 ++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/package.v2.json b/package.v2.json index 9f1fd0e..b6660c2 100644 --- a/package.v2.json +++ b/package.v2.json @@ -217,11 +217,12 @@ "name": "IYUU自动辅种", "description": "基于IYUU官方Api实现自动辅种。", "labels": "做种,IYUU", - "version": "2.10", + "version": "2.11", "icon": "IYUU.png", "author": "jxxghp,ckun", "level": 2, "history": { + "v2.11": "修复qb跳过校验不自动开始的问题", "v2.10": "Revert 辅种结束后,一起开始所有辅种后暂停的种子(排除了出错的种子)", "v2.9": "修复开启跳过校验后,Tr下载器不自动开始的问题", "v2.8": "为配置主辅分离时,不走辅种下载器检查", diff --git a/plugins.v2/iyuuautoseed/__init__.py b/plugins.v2/iyuuautoseed/__init__.py index 1533e3b..e78de3e 100644 --- a/plugins.v2/iyuuautoseed/__init__.py +++ b/plugins.v2/iyuuautoseed/__init__.py @@ -33,7 +33,7 @@ class IYUUAutoSeed(_PluginBase): # 插件图标 plugin_icon = "IYUU.png" # 插件版本 - plugin_version = "2.10" + plugin_version = "2.11" # 插件作者 plugin_author = "jxxghp,ckun" # 作者主页 @@ -1037,19 +1037,13 @@ class IYUUAutoSeed(_PluginBase): # 必须要用户自行二次确认之后才能开始做种 # 否则会出现反复下载刷掉分享率、做假种的情况 else: - # 追加校验任务 - 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) # 开始校验种子 downloader_obj.recheck_torrents(ids=[download_id]) - else: - # 追加校验任务 - 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) + # 追加校验任务 + 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) # 下载成功 logger.info(f"成功添加辅种下载,站点:{site_info.get('name')},种子链接:{torrent_url}") # 成功也加入缓存,有一些改了路径校验不通过的,手动删除后,下一次又会辅上 From b8750243225f28fc5539549d63f9768c591083a6 Mon Sep 17 00:00:00 2001 From: iamckun Date: Wed, 22 Jan 2025 21:33:30 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20iyuu=E8=87=AA=E5=8A=A8=E8=BE=85?= =?UTF-8?q?=E7=A7=8D=E6=8F=92=E4=BB=B6=E8=AF=B4=E6=98=8E=20feat:=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E7=B1=BB=E5=A4=8D=E7=94=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E5=B0=86=E5=8E=9F=E7=A7=8D=E5=AD=90=E7=9A=84?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=9C=A8=E8=BE=85=E7=A7=8D=E4=B8=AD=E5=A4=8D?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.v2.json | 3 +- plugins.v2/iyuuautoseed/README.md | 40 +++++++++++ plugins.v2/iyuuautoseed/__init__.py | 105 ++++++++++++++++++++++++---- 3 files changed, 135 insertions(+), 13 deletions(-) create mode 100644 plugins.v2/iyuuautoseed/README.md diff --git a/package.v2.json b/package.v2.json index b6660c2..ad1d073 100644 --- a/package.v2.json +++ b/package.v2.json @@ -217,11 +217,12 @@ "name": "IYUU自动辅种", "description": "基于IYUU官方Api实现自动辅种。", "labels": "做种,IYUU", - "version": "2.11", + "version": "2.12", "icon": "IYUU.png", "author": "jxxghp,ckun", "level": 2, "history": { + "v2.12": "增加qb下载器分类复用配置", "v2.11": "修复qb跳过校验不自动开始的问题", "v2.10": "Revert 辅种结束后,一起开始所有辅种后暂停的种子(排除了出错的种子)", "v2.9": "修复开启跳过校验后,Tr下载器不自动开始的问题", diff --git a/plugins.v2/iyuuautoseed/README.md b/plugins.v2/iyuuautoseed/README.md new file mode 100644 index 0000000..65afafa --- /dev/null +++ b/plugins.v2/iyuuautoseed/README.md @@ -0,0 +1,40 @@ +# IYUU自动辅种 + +## 下载器说明 +下载器为多选,选择多个下载器时,各个下载器的种子辅种互不影响 + +## 主辅分离说明 +- 配置主辅分离后,下载器所有的种子辅种时都会将所辅的种子下载到主辅分离下载器中 +- ⚠️注意主辅分离下载器不要配置到下载器中,这会导致主辅分离分离下载器中没有主下载器中的种子,重复将主下载中的种子下载到辅种下载器中。导致重复做种 + +## 辅种体积大小(GB) +种子文件大于该配置才会辅种 + +## 辅种站点 +配置需要参与辅种的站点 + +## 不辅种标签 +有该标签的种子会跳过不进行辅种 + +## 辅种后增加标签 +辅种成功后会将该配置的标签加入到下载器中,多个标签使用`,`分隔 + +## 辅种后增加分类 +- 辅种指定的分类,入启用了[分类复用](#分类复用)会优先使用该配置获取原种子的分类并设置 +- 如下载器配置了`自动分类管理`建议启用[分类复用](#分类复用)避免空分类和原分类不通导致下载路径不同无法辅种 + +## 不辅种数据文件目录 +不需要辅种的文件目录配置下载中的目录 + +## 将站点名添加到标签 +可以将站点名称加入到标签中 + +## 跳过校验 +- 仅QB下载器有效,跳过后可能会导致反复下载刷掉分享率、做假种的情况。本人仅仅测试了 QB `v4.6.6` 跳过无文件时不会自动开始,若有问题及时反馈将增加按钮选择是否需要跳过 +- Tr下载器在4.0.x中属于默认行为 + +## 分类复用 +将复用原种子的分离,当原种子无分类时使用[辅种后增加分类](#辅种后增加分类)配置中的分类 + +## 清除缓存后运行 +将清理辅种成功或失败的种子缓存,完整跑完每个种子每个站点的辅种操作。 \ No newline at end of file diff --git a/plugins.v2/iyuuautoseed/__init__.py b/plugins.v2/iyuuautoseed/__init__.py index e78de3e..776d4fc 100644 --- a/plugins.v2/iyuuautoseed/__init__.py +++ b/plugins.v2/iyuuautoseed/__init__.py @@ -33,7 +33,7 @@ class IYUUAutoSeed(_PluginBase): # 插件图标 plugin_icon = "IYUU.png" # 插件版本 - plugin_version = "2.11" + plugin_version = "2.12" # 插件作者 plugin_author = "jxxghp,ckun" # 作者主页 @@ -61,6 +61,8 @@ class IYUUAutoSeed(_PluginBase): _downloaders = [] # 辅种下载器 _auto_downloader = None + # 自动分类 + _auto_category = False _sites = [] _notify = False _nolabels = None @@ -116,6 +118,7 @@ class IYUUAutoSeed(_PluginBase): self._nopaths = config.get("nopaths") self._labelsafterseed = config.get("labelsafterseed") if config.get("labelsafterseed") else "已整理,辅种" self._categoryafterseed = config.get("categoryafterseed") + self._auto_category = config.get("auto_category") self._addhosttotag = config.get("addhosttotag") self._size = float(config.get("size")) if config.get("size") else 0 self._clearcache = config.get("clearcache") @@ -508,7 +511,7 @@ class IYUUAutoSeed(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 4 + 'md': 3 }, 'content': [ { @@ -524,7 +527,7 @@ class IYUUAutoSeed(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 4 + 'md': 3 }, 'content': [ { @@ -540,7 +543,23 @@ class IYUUAutoSeed(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'md': 4 + 'md': 3 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'auto_category', + 'label': '分类复用(仅QB有效)', + } + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 3 }, 'content': [ { @@ -553,6 +572,50 @@ class IYUUAutoSeed(_PluginBase): ] } ] + }, + { + 'component': 'VRow', + 'props': { + 'style': { + 'margin-top': '12px' + }, + }, + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'error', + 'variant': 'tonal' + }, + 'content': [ + { + 'component': 'span', + 'text': '注意:详细配置说明和注意事项请参考:' + }, + { + 'component': 'a', + 'props': { + 'href': 'https://github.com/jxxghp/MoviePilot-Plugins/tree/main/plugins.v2/iyuuautoseed/README.md', + 'target': '_blank' + }, + 'content': [ + { + 'component': 'u', + 'text': 'README' + } + ] + } + ] + } + ] + } + ] } ] } @@ -563,6 +626,7 @@ class IYUUAutoSeed(_PluginBase): "notify": False, "clearcache": False, "addhosttotag": False, + "auto_category": False, "cron": "", "token": "", "downloaders": [], @@ -595,6 +659,7 @@ class IYUUAutoSeed(_PluginBase): "labelsafterseed": self._labelsafterseed, "categoryafterseed": self._categoryafterseed, "addhosttotag": self._addhosttotag, + "auto_category": self._auto_category, "size": self._size, "success_caches": self._success_caches, "error_caches": self._error_caches, @@ -662,16 +727,16 @@ class IYUUAutoSeed(_PluginBase): break if is_skip: continue - # 体积排除辅种 torrent_size = self.__get_torrent_size(torrent=torrent, dl_type=service.type) / 1024 / 1024 / 1024 if self._size and torrent_size < self._size: logger.info(f"种子 {hash_str} 大小:{torrent_size:.2f}GB,小于设定 {self._size}GB,跳过 ...") continue - + category = self.__get_category(torrent=torrent, dl_type=service.type) if self._auto_category else None hash_strs.append({ "hash": hash_str, - "save_path": save_path + "save_path": save_path, + "category": category or self._categoryafterseed }) if hash_strs: logger.info(f"总共需要辅种的种子数:{len(hash_strs)}") @@ -771,8 +836,10 @@ class IYUUAutoSeed(_PluginBase): hashs = [item.get("hash") for item in hash_strs] # 每个Hash的保存目录 save_paths = {} + save_category = {} for item in hash_strs: save_paths[item.get("hash")] = item.get("save_path") + save_category[item.get("hash")] = item.get("category") # 查询可辅种数据 seed_list, msg = self.iyuu_helper.get_seed_info(hashs) if not isinstance(seed_list, dict): @@ -815,11 +882,13 @@ class IYUUAutoSeed(_PluginBase): if self._auto_downloader: success = self.__download_torrent(seed=seed, service=self.auto_service_info, - save_path=save_paths.get(current_hash)) + save_path=save_paths.get(current_hash), + save_category=save_category.get(current_hash)) else: success = self.__download_torrent(seed=seed, service=service, - save_path=save_paths.get(current_hash)) + save_path=save_paths.get(current_hash), + save_category=save_category.get(current_hash)) if success: success_torrents.append(seed.get("info_hash")) @@ -884,7 +953,7 @@ class IYUUAutoSeed(_PluginBase): print(str(e)) def __download(self, service: ServiceInfo, content: bytes, - save_path: str, site_name: str) -> Optional[str]: + save_path: str, save_category: str, site_name: str) -> Optional[str]: torrent_tags = self._labelsafterseed.split(',') @@ -905,7 +974,7 @@ class IYUUAutoSeed(_PluginBase): download_dir=save_path, is_paused=True, tag=torrent_tags, - category=self._categoryafterseed, + category=save_category, is_skip_checking=self._skipverify) if not state: return None @@ -930,7 +999,7 @@ class IYUUAutoSeed(_PluginBase): logger.error(f"不支持的下载器:{service.type}") return None - def __download_torrent(self, seed: dict, service: ServiceInfo, save_path: str): + def __download_torrent(self, seed: dict, service: ServiceInfo, save_path: str, save_category: str): """ 下载种子 torrent: { @@ -1019,6 +1088,7 @@ class IYUUAutoSeed(_PluginBase): download_id = self.__download(service=service, content=content, save_path=save_path, + save_category=save_category, site_name=site_info.get("name")) if not download_id: # 下载失败 @@ -1073,6 +1143,17 @@ class IYUUAutoSeed(_PluginBase): print(str(e)) return [] + @staticmethod + def __get_category(torrent: Any, dl_type: str): + """ + 获取种子标签 + """ + try: + return torrent.get("category") if dl_type == "qbittorrent" else None + except Exception as e: + print(str(e)) + return [] + @staticmethod def __can_seeding(torrent: Any, dl_type: str): """ From 7e7d4783fd84c60bd2588c5167bfdd01b7060333 Mon Sep 17 00:00:00 2001 From: iamckun Date: Wed, 22 Jan 2025 21:35:04 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20iyuu=E8=87=AA=E5=8A=A8=E8=BE=85?= =?UTF-8?q?=E7=A7=8D=E6=8F=92=E4=BB=B6=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.v2/iyuuautoseed/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins.v2/iyuuautoseed/README.md b/plugins.v2/iyuuautoseed/README.md index 65afafa..1641f19 100644 --- a/plugins.v2/iyuuautoseed/README.md +++ b/plugins.v2/iyuuautoseed/README.md @@ -1,40 +1,52 @@ # IYUU自动辅种 ## 下载器说明 + 下载器为多选,选择多个下载器时,各个下载器的种子辅种互不影响 ## 主辅分离说明 + - 配置主辅分离后,下载器所有的种子辅种时都会将所辅的种子下载到主辅分离下载器中 - ⚠️注意主辅分离下载器不要配置到下载器中,这会导致主辅分离分离下载器中没有主下载器中的种子,重复将主下载中的种子下载到辅种下载器中。导致重复做种 ## 辅种体积大小(GB) + 种子文件大于该配置才会辅种 ## 辅种站点 + 配置需要参与辅种的站点 ## 不辅种标签 + 有该标签的种子会跳过不进行辅种 ## 辅种后增加标签 + 辅种成功后会将该配置的标签加入到下载器中,多个标签使用`,`分隔 ## 辅种后增加分类 + - 辅种指定的分类,入启用了[分类复用](#分类复用)会优先使用该配置获取原种子的分类并设置 - 如下载器配置了`自动分类管理`建议启用[分类复用](#分类复用)避免空分类和原分类不通导致下载路径不同无法辅种 ## 不辅种数据文件目录 + 不需要辅种的文件目录配置下载中的目录 ## 将站点名添加到标签 + 可以将站点名称加入到标签中 ## 跳过校验 + - 仅QB下载器有效,跳过后可能会导致反复下载刷掉分享率、做假种的情况。本人仅仅测试了 QB `v4.6.6` 跳过无文件时不会自动开始,若有问题及时反馈将增加按钮选择是否需要跳过 - Tr下载器在4.0.x中属于默认行为 ## 分类复用 + 将复用原种子的分离,当原种子无分类时使用[辅种后增加分类](#辅种后增加分类)配置中的分类 ## 清除缓存后运行 + 将清理辅种成功或失败的种子缓存,完整跑完每个种子每个站点的辅种操作。 \ No newline at end of file From f5d7ad6c9ace1ffc7f1eb44a60ba38fb3871fd68 Mon Sep 17 00:00:00 2001 From: iamckun Date: Wed, 22 Jan 2025 21:48:04 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20iyuu=E8=87=AA=E5=8A=A8=E8=BE=85?= =?UTF-8?q?=E7=A7=8D=E6=8F=92=E4=BB=B6=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.v2/iyuuautoseed/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins.v2/iyuuautoseed/README.md b/plugins.v2/iyuuautoseed/README.md index 1641f19..33dd3a2 100644 --- a/plugins.v2/iyuuautoseed/README.md +++ b/plugins.v2/iyuuautoseed/README.md @@ -7,7 +7,7 @@ ## 主辅分离说明 - 配置主辅分离后,下载器所有的种子辅种时都会将所辅的种子下载到主辅分离下载器中 -- ⚠️注意主辅分离下载器不要配置到下载器中,这会导致主辅分离分离下载器中没有主下载器中的种子,重复将主下载中的种子下载到辅种下载器中。导致重复做种 +- ⚠️注意主辅分离下载器不要配置到下载器中,这会导致主辅分离下载器中没有主下载器中的种子,重复将主下载中的种子下载到辅种下载器中。导致重复做种 ## 辅种体积大小(GB) @@ -28,7 +28,7 @@ ## 辅种后增加分类 - 辅种指定的分类,入启用了[分类复用](#分类复用)会优先使用该配置获取原种子的分类并设置 -- 如下载器配置了`自动分类管理`建议启用[分类复用](#分类复用)避免空分类和原分类不通导致下载路径不同无法辅种 +- 如下载器配置了`自动分类管理`建议启用[分类复用](#分类复用)避免空分类和原分类不同导致下载路径不同无法辅种 ## 不辅种数据文件目录 From b6ddd58263834890bb7b28c38c4f4846c26ac472 Mon Sep 17 00:00:00 2001 From: iamckun Date: Wed, 22 Jan 2025 21:49:56 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.v2/iyuuautoseed/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins.v2/iyuuautoseed/__init__.py b/plugins.v2/iyuuautoseed/__init__.py index 776d4fc..5307433 100644 --- a/plugins.v2/iyuuautoseed/__init__.py +++ b/plugins.v2/iyuuautoseed/__init__.py @@ -1146,7 +1146,7 @@ class IYUUAutoSeed(_PluginBase): @staticmethod def __get_category(torrent: Any, dl_type: str): """ - 获取种子标签 + 获取种子分类 """ try: return torrent.get("category") if dl_type == "qbittorrent" else None