diff --git a/package.json b/package.json index dab3491..b65b458 100644 --- a/package.json +++ b/package.json @@ -186,7 +186,7 @@ "CrossSeed": { "name": "青蛙辅种助手", "description": "参考ReseedPuppy和IYUU辅种插件实现自动辅种,支持站点:青蛙、AGSVPT、麒麟、UBits、聆音、憨憨等。", - "version": "1.9", + "version": "2.0", "icon": "qingwa.png", "author": "233@qingwa", "level": 2 @@ -226,7 +226,7 @@ "BrushFlow": { "name": "站点刷流", "description": "自动托管刷流,将会提高对应站点的访问频率。", - "version": "2.1", + "version": "2.2", "icon": "brush.jpg", "author": "jxxghp", "level": 2 @@ -458,7 +458,7 @@ "DownloaderHelper": { "name": "下载器助手", "description": "自动做种、站点标签、自动删种。", - "version": "1.3", + "version": "1.4", "icon": "DownloaderHelper.png", "author": "hotlcc", "level": 2 diff --git a/plugins/brushflow/__init__.py b/plugins/brushflow/__init__.py index 064dc83..c9d3d24 100644 --- a/plugins/brushflow/__init__.py +++ b/plugins/brushflow/__init__.py @@ -117,8 +117,10 @@ class BrushConfig: self.group_site_configs[sitename] = BrushConfig(config=full_config, process_site_config=False) except Exception as e: - logger.error(f"解析站点配置失败,请检查配置项。错误详情: {e}") + logger.error(f"解析站点配置失败,已停用插件并关闭站点独立配置,请检查配置项,错误详情: {e}") self.group_site_configs = {} + self.enable_site_config = False + self.enabled = False def get_site_config(self, sitename): """ @@ -182,7 +184,7 @@ class BrushFlow(_PluginBase): # 插件图标 plugin_icon = "brush.jpg" # 插件版本 - plugin_version = "2.1" + plugin_version = "2.2" # 插件作者 plugin_author = "jxxghp,InfinityPacer" # 作者主页 @@ -2250,7 +2252,7 @@ class BrushFlow(_PluginBase): need_delete_hashes = [] - # 即使开了动态删除,但是也有可能部分站点单独设置了关闭,这里根据种子动态进行分组,先处理不需要动态的种子,按设置的规则进行删除 + # 即使开了动态删除,但是也有可能部分站点单独设置了关闭,这里根据种子托管进行分组,先处理不需要托管的种子,按设置的规则进行删除 proxy_delete_torrents, not_proxy_delete_torrents = self.__group_torrents_by_proxy_delete(torrents=torrents, torrent_tasks=torrent_tasks) logger.info(f"托管种子数 {len(proxy_delete_torrents)},未托管种子数 {len(not_proxy_delete_torrents)}") @@ -2262,7 +2264,7 @@ class BrushFlow(_PluginBase): torrent_info_map[self.__get_hash(torrent)].get("total_size", 0) for torrent in not_proxy_delete_torrents if self.__get_hash(torrent) in not_proxy_delete_hashes) - # 如果删除非动态种子后仍未达到最小体积要求,则处理动态种子 + # 如果删除非托管种子后仍未达到最小体积要求,则处理托管种子 if total_torrent_size > min_size and proxy_delete_torrents: proxy_delete_hashes = self.__delete_torrent_for_evaluate_conditions(torrents=proxy_delete_torrents, torrent_tasks=torrent_tasks, @@ -2272,7 +2274,7 @@ class BrushFlow(_PluginBase): torrent_info_map[self.__get_hash(torrent)].get("total_size", 0) for torrent in proxy_delete_torrents if self.__get_hash(torrent) in proxy_delete_hashes) - # 在完成初始删除步骤后,如果总体积仍然超过最小阈值,则进一步找到已完成种子并排除HR种子后按加入时间倒序进行删除 + # 在完成初始删除步骤后,如果总体积仍然超过最小阈值,则进一步找到已完成种子并排除HR种子后按加入时间正序进行删除 if total_torrent_size > min_size: # 重新计算当前的种子列表,排除已删除的种子 remaining_hashes = list( @@ -2705,7 +2707,7 @@ class BrushFlow(_PluginBase): else: logger.error('代理下载种子失败,继续尝试传递种子地址到下载器进行下载') if torrent_content: - torrent = self.tr.add_torrent(content=torrent.enclosure, + torrent = self.tr.add_torrent(content=torrent_content, download_dir=download_dir, cookie=torrent.site_cookie, labels=["已整理", brush_config.brush_tag]) diff --git a/plugins/crossseed/__init__.py b/plugins/crossseed/__init__.py index 3d79420..fc75269 100644 --- a/plugins/crossseed/__init__.py +++ b/plugins/crossseed/__init__.py @@ -1,6 +1,7 @@ import hashlib import os import re +import time from datetime import datetime, timedelta from pathlib import Path from threading import Event @@ -42,6 +43,7 @@ class CSSiteConfig(object): cookie: str = None, ua: str = None, proxy: bool = None, + query_gap: int = 1, ) -> None: self.name = name self.url = url @@ -50,6 +52,7 @@ class CSSiteConfig(object): self.cookie = cookie self.ua = ua self.proxy = proxy + self.query_gap = query_gap def get_api_url(self): if self.name == "憨憨": @@ -160,6 +163,7 @@ class CrossSeedHelper(object): remote_torrent_infos.append( TorInfo.remote(site.name, pieces_hash, torrent_id) ) + time.sleep(site.query_gap) except requests.exceptions.RequestException as e: return None, f"站点{site.name}请求失败:{e}" return remote_torrent_infos, None @@ -173,7 +177,7 @@ class CrossSeed(_PluginBase): # 插件图标 plugin_icon = "qingwa.png" # 插件版本 - plugin_version = "1.9" + plugin_version = "2.0" # 插件作者 plugin_author = "233@qingwa" # 作者主页 @@ -240,7 +244,7 @@ class CrossSeed(_PluginBase): self._downloaders = config.get("downloaders") self._torrentpath = config.get("torrentpath") # 种子路径和下载器对应 /qb,/tr - self._torrentpaths = self._torrentpath.split(",") + self._torrentpaths = self._torrentpath.strip().split(",") self._sites = config.get("sites") or [] self._notify = config.get("notify") self._nolabels = config.get("nolabels") @@ -282,13 +286,21 @@ class CrossSeed(_PluginBase): ) self._sites = [site.id for site in all_site_cs_info_map.values() if site.id in self._sites] site_names = [site.name for site in all_site_cs_info_map.values() if site.id in self._sites] - + # 整理passkey映射关系 site_name_key_map = dict() + site_name_gap_map = dict() for site_key in self._token.strip().split("\n"): site_key_arr = re.split("[\s::]+",site_key.strip()) site_name = site_key_arr[0] site_name_key_map[site_name] = site_key_arr[1] + if len(site_key_arr) > 2: + if str.isdigit(site_key_arr[2]): + site_name_gap_map[site_name] = int(site_key_arr[2]) + else: + logger.warn( + f"站点{site_name}配置的查询请求间隔时间不为整数,不能生效, 请修改 {site_key_arr[2]}" + ) # 只给选中的站点补全站点配置 self._site_cs_infos: List[CSSiteConfig] = [] @@ -300,6 +312,10 @@ class CrossSeed(_PluginBase): continue site_cs_info = all_site_cs_info_map.get(site_name) site_cs_info.passkey = site_key + # 追加设置的请求间隔时间 + site_query_gap = site_name_gap_map.get(site_name) + if site_query_gap: + site_cs_info.query_gap = site_query_gap self._site_cs_infos.append(site_cs_info) self.__update_config() @@ -653,7 +669,7 @@ class CrossSeed(_PluginBase): 'type': 'info', 'variant': 'tonal', 'text': '1. 定时任务周期建议每次辅种间隔时间大于1天,不填写每天上午2点到7点随机辅种一次; ' - '2. 支持辅种站点列表:青蛙【已验证】,AGSVPT,麒麟,UBits,聆音 等,配置passkey时,站点名称需严格和上面选项一致,只有选中的站点会辅种,passkey可保存多个; ' + '2. 支持辅种站点列表:青蛙、AGSVPT、红豆饭、麒麟、UBits、聆音等,配置passkey时,站点名称需严格和上面选项一致,只有选中的站点会辅种,passkey可保存多个; ' '3. 请勿与IYUU辅种插件同时添加相同站点,可能会有冲突,且意义不大;' '4. 测试站点是否支持的方法:【站点域名/api/pieces-hash】接口访问返回405则大概率支持 ' } @@ -661,6 +677,29 @@ class CrossSeed(_PluginBase): ] } ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '【进阶设置】如果辅种过程中访问/api/pieces-hash接口偶尔会失败,可以设置请求间隔时间。 ' + '可以在passkey后增加 :3 来将某个站点的请求间隔调整为3秒,3可以改为其他数字,只能为整数,默认请求间隔为1秒。 ' + '示例配置 站点名称:Passkey:3' + } + } + ] + } + ] } ] } diff --git a/plugins/downloaderhelper/__init__.py b/plugins/downloaderhelper/__init__.py index 52ebeb6..817c264 100644 --- a/plugins/downloaderhelper/__init__.py +++ b/plugins/downloaderhelper/__init__.py @@ -32,7 +32,7 @@ class DownloaderHelper(_PluginBase): # 插件图标 plugin_icon = "DownloaderHelper.png" # 插件版本 - plugin_version = "1.3" + plugin_version = "1.4" # 插件作者 plugin_author = "hotlcc" # 作者主页 @@ -177,87 +177,90 @@ class DownloaderHelper(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '插件总开关' + 'md': 4, + 'xl': 3 }, 'content': [{ 'component': 'VSwitch', 'props': { 'model': 'enable', - 'label': '启用插件' + 'label': '启用插件', + 'hint': '插件总开关' } }] }, { 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '执行插件任务后是否发送通知' + 'md': 4, + 'xl': 3 }, 'content': [{ 'component': 'VSwitch', 'props': { 'model': 'enable_notify', - 'label': '发送通知' + 'label': '发送通知', + 'hint': '执行插件任务后是否发送通知' } }] }, { 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '保存插件配置后是否立即触发一次插件任务运行' + 'md': 4, + 'xl': 3 }, 'content': [{ 'component': 'VSwitch', 'props': { 'model': 'run_once', - 'label': '立即运行一次' + 'label': '立即运行一次', + 'hint': '保存插件配置后是否立即触发一次插件任务运行' } }] - }] - }, { - 'component': 'VRow', - 'content': [{ + }, { 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '监听下载添加事件。当MoviePilot添加下载任务时,会触发执行本插件进行自动做种和添加站点标签。' + 'md': 4, + 'xl': 3 }, 'content': [{ 'component': 'VSwitch', 'props': { 'model': 'listen_download_event', - 'label': '监听下载事件' + 'label': '监听下载事件', + 'hint': '监听下载添加事件。当MoviePilot添加下载任务时,会触发执行本插件进行自动做种和添加站点标签。' } }] }, { 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '监听源文件删除事件。当在【历史记录】中删除源文件时,会自动触发运行本插件任务进行自动删种。' + 'md': 4, + 'xl': 3 }, 'content': [{ 'component': 'VSwitch', 'props': { 'model': 'listen_source_file_event', - 'label': '监听源文件事件' + 'label': '监听源文件事件', + 'hint': '监听源文件删除事件。当在【历史记录】中删除源文件时,会自动触发运行本插件任务进行自动删种。' } }] }, { 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '给种子添加站点标签时,是否优先以站点名称作为标签内容(否则将使用域名关键字)?' + 'md': 4, + 'xl': 3 }, 'content': [{ 'component': 'VSwitch', 'props': { 'model': 'site_name_priority', - 'label': '站点名称优先' + 'label': '站点名称优先', + 'hint': '给种子添加站点标签时,是否优先以站点名称作为标签内容(否则将使用域名关键字)?' } }] }] @@ -267,44 +270,44 @@ class DownloaderHelper(_PluginBase): 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '设置插件任务执行周期。支持5位cron表达式,应避免任务执行过于频繁,例如:0/30 * * * *。缺省时不执行定时任务,但不影响监听任务的执行。' + 'md': 4 }, 'content': [{ 'component': 'VTextField', 'props': { 'model': 'cron', 'label': '定时执行周期', - 'placeholder': '0/30 * * * *' + 'placeholder': '0/30 * * * *', + 'hint': '设置插件任务执行周期。支持5位cron表达式,应避免任务执行过于频繁,例如:0/30 * * * *。缺省时不执行定时任务,但不影响监听任务的执行。' } }] }, { 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '下载器中的种子有这些标签时不进行任何操作,多个标签使用英文“,”分割' + 'md': 4 }, 'content': [{ 'component': 'VTextField', 'props': { 'model': 'exclude_tags', - 'label': '排除种子标签' + 'label': '排除种子标签', + 'hint': '下载器中的种子有这些标签时不进行任何操作,多个标签使用英文“,”分割' } }] }, { 'component': 'VCol', 'props': { 'cols': 12, - 'xxl': 3, 'xl': 3, 'lg': 3, 'md': 3, 'sm': 6, 'xs': 12, - 'title': '给种子添加站点标签时的标签前缀,默认值为“站点/”' + 'md': 4 }, 'content': [{ 'component': 'VTextField', 'props': { 'model': 'tag_prefix', 'label': '站点标签前缀', - 'placeholder': '站点/' + 'placeholder': '站点/', + 'hint': '给种子添加站点标签时的标签前缀,默认值为“站点/”' } }] }] @@ -313,8 +316,7 @@ class DownloaderHelper(_PluginBase): 'content': [{ 'component': 'VCol', 'props': { - 'cols': 12, - 'title': 'Tracker映射。用于在站点打标签时,指定tracker和站点域名不同的种子的域名对应关系;前面为tracker域名(完整域名或者主域名皆可),中间是英文冒号,后面是站点域名。' + 'cols': 12 }, 'content': [{ 'component': 'VTextarea', @@ -324,7 +326,8 @@ class DownloaderHelper(_PluginBase): 'placeholder': '格式:\n' ':\n' '例如:\n' - 'chdbits.xyz:ptchdbits.co' + 'chdbits.xyz:ptchdbits.co', + 'hint': 'Tracker映射。用于在站点打标签时,指定tracker和站点域名不同的种子的域名对应关系;前面为tracker域名(完整域名或者主域名皆可),中间是英文冒号,后面是站点域名。' } }] }] @@ -373,7 +376,8 @@ class DownloaderHelper(_PluginBase): 'component': 'VSwitch', 'props': { 'model': 'qb_enable', - 'label': '任务开关' + 'label': '任务开关', + 'hint': '该下载器子任务的开关' } }] }, { @@ -386,7 +390,8 @@ class DownloaderHelper(_PluginBase): 'component': 'VSwitch', 'props': { 'model': 'qb_enable_seeding', - 'label': '自动做种' + 'label': '自动做种', + 'hint': '是否开启自动做种功能' } }] }, { @@ -399,7 +404,8 @@ class DownloaderHelper(_PluginBase): 'component': 'VSwitch', 'props': { 'model': 'qb_enable_tagging', - 'label': '站点标签' + 'label': '站点标签', + 'hint': '是否开启站点标签功能' } }] }, { @@ -412,7 +418,8 @@ class DownloaderHelper(_PluginBase): 'component': 'VSwitch', 'props': { 'model': 'qb_enable_delete', - 'label': '自动删种' + 'label': '自动删种', + 'hint': '是否开启自动删种功能' } }] }]