From 07203fc264103a212c6ac9809c27f2cbe2dd75a9 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Sun, 4 May 2025 00:57:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=AA=E6=9C=89=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=9C=89=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=91=E4=B9=9F=E6=98=BE=E7=A4=BA=E5=AD=90=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quark_auto_save.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/quark_auto_save.py b/quark_auto_save.py index bbe9d36..dd6d81e 100644 --- a/quark_auto_save.py +++ b/quark_auto_save.py @@ -3513,6 +3513,11 @@ def do_save(account, tasklist=[]): add_notify(f"✅《{task['taskname']}》添加追更:") add_notify(f"/{task['savepath']}") + # 修正首次运行时对子目录的处理 - 只有在首次运行且有新增的子目录时才显示子目录内容 + if has_update_in_root and has_update_in_subdir and is_first_run and len(new_added_dirs) == 0: + # 虽然标记为首次运行,但没有新增子目录,不应展示子目录内容 + has_update_in_subdir = False + # 构建完整的目录树结构(支持多层级嵌套) def build_directory_tree(): # 创建目录树结构 @@ -3613,12 +3618,21 @@ def do_save(account, tasklist=[]): save_path_parts = save_path.split("/") save_path_basename = save_path_parts[-1] if save_path else "" + # 过滤目录 - 如果只有根目录有更新,且不是首次运行或没有新增目录,则不显示子目录 + if depth == 0 and has_update_in_root and (not has_update_in_subdir or (is_first_run and len(new_added_dirs) == 0)): + # 在根目录级别,如果只有根目录有更新,则过滤掉所有子目录 + dirs = [] + # 计算总项数(目录+文件) total_items = len(dirs) + len(files) current_item = 0 # 处理目录 for i, (dir_name, dir_data) in enumerate(dirs): + # 检查目录是否在新增目录列表中或有子文件更新 + if is_first_run and dir_name not in new_added_dirs and len(dir_data.get("files", [])) == 0: + continue + current_item += 1 is_dir_last = current_item == total_items