improve system folder skip
This commit is contained in:
parent
4abf9c14b1
commit
6b8f27ad19
3
app.py
3
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
|
||||
|
||||
|
||||
@ -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,))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user