From 6b8f27ad1937795f0c0bc770c2829c2ace63a954 Mon Sep 17 00:00:00 2001 From: lelo Date: Sat, 24 Jan 2026 13:25:10 +0000 Subject: [PATCH] improve system folder skip --- app.py | 3 ++- index_for_search.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index eccdb9d..04d0d96 100755 --- a/app.py +++ b/app.py @@ -562,7 +562,8 @@ def list_directory_contents(directory, subpath): continue if entry.is_dir(follow_symlinks=False): - if entry.name in ["Transkription", "@eaDir", ".ai"]: + # skip system/hidden helper folders + if entry.name in ["Transkription", "@eaDir", ".app", "#recycle"]: continue rel_path = os.path.join(subpath, entry.name) if subpath else entry.name diff --git a/index_for_search.py b/index_for_search.py index a5c0cb5..269b552 100755 --- a/index_for_search.py +++ b/index_for_search.py @@ -106,9 +106,9 @@ def log_structure(root_path, max_depth=None, show_files=False): entries = sorted(it, key=lambda e: (not e.is_dir(follow_symlinks=False), e.name.lower())) for entry in entries: if entry.is_dir(follow_symlinks=False): - if entry.name.startswith(('.', '@', '#')): + if entry.name.startswith(('.')): continue - if entry.name.lower() in {"transkription"}: + if entry.name in {"Transkription", "@eaDir", ".app", "#recycle"}: continue indent = " " * (depth - 1) log(f"{indent}- {entry.name}/") @@ -151,7 +151,8 @@ def updatefileindex(): log(f"Processing folder: {foldername}") raw_folderpath = folder.get("folderpath") norm_folderpath = os.path.normpath(raw_folderpath) - log_structure(norm_folderpath, max_depth=None, show_files=False) + # Only log folder names up to 3 levels deep; suppress filenames + log_structure(norm_folderpath, max_depth=3, show_files=False) # Precompute the length of the base folder path (plus one for the separator) base_len = len(norm_folderpath) + 1 # Prefetch hit counts for this basefolder to avoid per-file queries @@ -210,6 +211,12 @@ def updatefileindex(): for d, files in dir_files.items(): log_directory_batch(d, files) + # Progress indicator + dir_count = len(dir_files) + file_count = len(scanned_files) + log(f"Found {dir_count} folders and {file_count} files in '{foldername}'.") + log("updating database...") + # Remove database entries for files under this base folder that are no longer on disk. pattern = foldername + os.sep + '%' cursor.execute("SELECT id, relative_path, filename FROM files WHERE relative_path LIKE ?", (pattern,))