From 167723200053c2dbc2f7a7c38627f7e599f4077a Mon Sep 17 00:00:00 2001 From: InfinityPacer <160988576+InfinityPacer@users.noreply.github.com> Date: Wed, 10 Jul 2024 20:50:58 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=A7=BB=E9=99=A4=E3=80=8C=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=9B=B4=E5=A4=9A=E6=97=A5=E5=BF=97=E3=80=8D=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9=EF=BC=8C=E8=B0=83=E6=95=B4=E4=B8=BADEBUG?= =?UTF-8?q?=E6=97=A5=E5=BF=97=EF=BC=8C=E4=BC=98=E5=8C=96=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/brushflow/__init__.py | 78 ++++++++++------------------------- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/plugins/brushflow/__init__.py b/plugins/brushflow/__init__.py index 0189777..b68c1a4 100644 --- a/plugins/brushflow/__init__.py +++ b/plugins/brushflow/__init__.py @@ -71,7 +71,6 @@ class BrushConfig: self.brush_sequential = config.get("brush_sequential", False) self.proxy_download = config.get("proxy_download", False) self.proxy_delete = config.get("proxy_delete", False) - self.log_more = config.get("log_more", False) self.active_time_range = config.get("active_time_range") self.downloader_monitor = config.get("downloader_monitor") self.qb_category = config.get("qb_category") @@ -340,11 +339,10 @@ class BrushFlow(_PluginBase): brush_config.archive_task = False self.__update_config() - if brush_config.log_more: - if brush_config.enable_site_config: - logger.info(f"已开启站点独立配置,配置信息:{brush_config}") - else: - logger.info(f"没有开启站点独立配置,配置信息:{brush_config}") + if brush_config.enable_site_config: + logger.debug(f"已开启站点独立配置,配置信息:{brush_config}") + else: + logger.debug(f"没有开启站点独立配置,配置信息:{brush_config}") # 停止现有任务 self.stop_service() @@ -366,8 +364,6 @@ class BrushFlow(_PluginBase): # 如果开启&存在站点时,才需要启用后台任务 self._task_brush_enable = brush_config.enabled and brush_config.brushsites - # brush_config.onlyonce = True - # 检查是否启用了一次性任务 if brush_config.onlyonce: self._scheduler = BackgroundScheduler(timezone=settings.TZ) @@ -974,11 +970,6 @@ class BrushFlow(_PluginBase): 'component': 'VWindow', 'props': { 'model': '_tabs' - # VWindow设置paddnig会导致切换Tab时页面高度变动,调整为修改VRow的方案 - # 'style': { - # 'padding-top': '24px', - # 'padding-bottom': '24px', - # }, }, 'content': [ { @@ -1426,7 +1417,7 @@ class BrushFlow(_PluginBase): 'component': 'VTextField', 'props': { 'model': 'seed_inactivetime', - 'label': '未活动时间(分钟) ', + 'label': '未活动时间(分钟)', 'placeholder': '超过时删除任务' } } @@ -1658,27 +1649,6 @@ class BrushFlow(_PluginBase): ] } ] - }, - { - 'component': 'VRow', - "content": [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 4 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'log_more', - 'label': '记录更多日志', - } - } - ] - } - ] } ] } @@ -1742,7 +1712,7 @@ class BrushFlow(_PluginBase): 'props': { 'type': 'error', 'variant': 'tonal', - 'text': '注意:排除H&R并不保证能完全适配所有站点(部分站点在列表页不显示H&R标志,但实际上是有H&R的),请注意核对使用!' + 'text': '注意:排除H&R并不保证能完全适配所有站点(部分站点在列表页不显示H&R标志,但实际上是有H&R的),请注意核对使用' } } ] @@ -1857,7 +1827,6 @@ class BrushFlow(_PluginBase): "freeleech": "free", "hr": "yes", "enable_site_config": False, - "log_more": False, "downloader_monitor": False, "auto_qb_category": False, "qb_first_last_piece": False, @@ -2055,9 +2024,6 @@ class BrushFlow(_PluginBase): if brush_config.site_hr_active: logger.info(f"站点 {siteinfo.name} 已开启全站H&R选项,所有种子设置为H&R种子") - # 由于缓存原因,这里不能直接改torrents,在后续加入任务中调整 - # for torrent in torrents: - # torrent.hit_and_run = True # 排除包含订阅的种子 if brush_config.except_subscribe: @@ -2068,7 +2034,7 @@ class BrushFlow(_PluginBase): torrents_size = self.__calculate_seeding_torrents_size(torrent_tasks=torrent_tasks) - logger.info(f"正在准备种子刷流,数量:{len(torrents)}") + logger.info(f"正在准备种子刷流,数量 {len(torrents)}") # 过滤种子 for torrent in torrents: @@ -2078,6 +2044,8 @@ class BrushFlow(_PluginBase): if not pre_condition_passed: return False + logger.debug(f"种子详情:{torrent}") + # 判断能否通过保种体积刷流条件 size_condition_passed, reason = self.__evaluate_size_condition_for_brush(torrents_size=torrents_size, add_torrent_size=torrent.size) @@ -2098,8 +2066,8 @@ class BrushFlow(_PluginBase): logger.warn(f"{torrent.title} 添加刷流任务失败!") continue - # 保存任务信息 - torrent_tasks[hash_string] = { + # 触发刷流下载时间并保存任务信息 + torrent_task = { "site": siteinfo.id, "site_name": siteinfo.name, "title": torrent.title, @@ -2306,7 +2274,8 @@ class BrushFlow(_PluginBase): return True, None - def __log_brush_conditions(self, passed: bool, reason: str, torrent: Any = None): + @staticmethod + def __log_brush_conditions(passed: bool, reason: str, torrent: Any = None): """ 记录刷流日志 """ @@ -2314,9 +2283,7 @@ class BrushFlow(_PluginBase): if not torrent: logger.warn(f"没有通过前置刷流条件校验,原因:{reason}") else: - brush_config = self.__get_brush_config() - if brush_config.log_more: - logger.warn(f"种子没有通过刷流条件校验,原因:{reason} 种子:{torrent.title}|{torrent.description}") + logger.debug(f"种子没有通过刷流条件校验,原因:{reason} 种子:{torrent.title}|{torrent.description}") # endregion @@ -2618,8 +2585,7 @@ class BrushFlow(_PluginBase): reason=reason) logger.info(f"站点:{site_name},{reason},删除种子:{torrent_title}|{torrent_desc}") else: - if brush_config.log_more: - logger.info(f"站点:{site_name},{reason},不删除种子:{torrent_title}|{torrent_desc}") + logger.debug(f"站点:{site_name},{reason},不删除种子:{torrent_title}|{torrent_desc}") return delete_hashes @@ -2657,8 +2623,7 @@ class BrushFlow(_PluginBase): reason=reason) logger.info(f"站点:{site_name},{reason},删除种子:{torrent_title}|{torrent_desc}") else: - if brush_config.log_more: - logger.info(f"站点:{site_name},{reason},不删除种子:{torrent_title}|{torrent_desc}") + logger.debug(f"站点:{site_name},{reason},不删除种子:{torrent_title}|{torrent_desc}") return delete_hashes @@ -2914,7 +2879,7 @@ class BrushFlow(_PluginBase): "active_downloaded": active_downloaded }) - logger.info(f"刷流任务统计数据:总任务数:{total_count},活跃任务数:{active_count},已删除:{total_deleted}," + logger.info(f"刷流任务统计数据,总任务数:{total_count},活跃任务数:{active_count},已删除:{total_deleted}," f"待归档:{total_unarchived}," f"活跃上传量:{StringUtils.str_filesize(active_uploaded)}," f"活跃下载量:{StringUtils.str_filesize(active_downloaded)}," @@ -3034,7 +2999,6 @@ class BrushFlow(_PluginBase): "brush_sequential": brush_config.brush_sequential, "proxy_download": brush_config.proxy_download, "proxy_delete": brush_config.proxy_delete, - "log_more": brush_config.log_more, "active_time_range": brush_config.active_time_range, "downloader_monitor": brush_config.downloader_monitor, "qb_category": brush_config.qb_category, @@ -3131,7 +3095,7 @@ class BrushFlow(_PluginBase): data = data.get(key) if not data: return None - logger.info(f"获取到下载地址:{data}") + logger.debug(f"获取到下载地址:{data}") return data return None @@ -3201,8 +3165,7 @@ class BrushFlow(_PluginBase): # 获取种子Hash torrent_hash = self.qb.get_torrent_id_by_tag(tags=tag) if not torrent_hash: - logger.error(f"{brush_config.downloader} 获取种子Hash失败" - f"{',请尝试启用「代理下载种子」配置项' if not brush_config.proxy_download else ''}") + logger.error(f"{brush_config.downloader} 获取种子Hash失败,详细信息请查看 README") return None return torrent_hash return None @@ -3766,7 +3729,8 @@ class BrushFlow(_PluginBase): for key in set(self._subscribe_infos) - current_keys: del self._subscribe_infos[key] - logger.info(f"订阅标题匹配完成,当前订阅的标题集合为:{self._subscribe_infos}") + logger.info("已订阅标题匹配完成") + logger.debug(f"当前订阅的标题集合为:{self._subscribe_infos}") unique_titles = {title for titles in self._subscribe_infos.values() for title in titles} return unique_titles