updated scan.py to help us error handle the weird searches and alos build an ignore list

This commit is contained in:
2026-07-09 16:21:20 -05:00
parent 041ffd1c3f
commit 60cc36893e
6 changed files with 60 additions and 4 deletions

View File

@@ -8,7 +8,9 @@ Writes the sorted list of drawer IDs to the configured drawer_id_file.
import os
import sys
from fccs_config import parse_args, load_config, make_logger
from fccs_config import (
parse_args, load_config, make_logger, load_lines, check_for_clashes,
)
def main():
@@ -18,6 +20,7 @@ def main():
backup_dir = cfg.get("paths", "backup_dir")
output_file = cfg.get("paths", "drawer_id_file")
ignore_file = cfg.get("paths", "ignore_file")
if not os.path.isdir(backup_dir):
log(f"ERROR: backup directory not found: {backup_dir}")
@@ -34,6 +37,30 @@ def main():
log(f"Found {len(drawer_ids)} drawers, written to {output_file}")
# Report which drawers are set to be ignored (skipped by the export).
ignored = set(load_lines(ignore_file))
if ignored:
present = sorted(ignored & set(drawer_ids))
log(f"Ignore list ({ignore_file}): {len(ignored)} IDs, "
f"{len(present)} present in this backup — these will be SKIPPED "
f"by fccs_export.py: {', '.join(present) if present else '(none present)'}")
# Flag prefix clashes: FCCS search on the shorter ID pops a selection box.
clashes = check_for_clashes(drawer_ids)
if clashes:
log("-" * 60)
log(f"WARNING: {len(clashes)} potential drawer ID clash(es) found.")
log("Searching the shorter ID in FCCS may show a selection box "
"instead of navigating directly, which breaks the export.")
log("Consider exporting these manually, or add the shorter ID to "
f"the ignore list ({ignore_file}).")
for short, matches in clashes:
flag = " [ignored]" if short in ignored else ""
log(f" {short}{flag} -> also matches: {', '.join(matches)}")
log("-" * 60)
else:
log("No drawer ID prefix clashes found.")
if __name__ == "__main__":
main()