diff --git a/README.md b/README.md index 7d98f84..b57ca09 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,12 @@ python fccs_scan.py Reads the restored FCCS backup directory and writes all drawer IDs (subfolder names) to `drawer_ids.txt`. It also: -- **Flags prefix clashes** — if one drawer ID is a prefix of another (e.g. `02218` and `02218A`), searching the shorter ID in FCCS pops up a selection box that breaks automated navigation. These clashes are reported, and the shorter (prefix) IDs are auto-seeded into `ignore.txt` for review. +- **Flags prefix clashes** — if one drawer ID is a prefix of another (e.g. `02218` and `02218A`), searching them in FCCS can pop up a selection box that breaks automated navigation. These clashes are reported, and **every drawer in each clash group** is auto-seeded into `ignore.txt` for review. - **Reports ignored drawers** — any IDs listed in `ignore.txt` that exist in this backup are shown as ones the export will skip. -**Ignoring drawers:** The scan creates `ignore.txt` (at `ignore_file`, default `C:\Migration\ignore.txt`) if it doesn't exist and pre-fills it with the clash prefixes — searching those in FCCS shows a selection box that stalls the automation, so they're skipped by default. Open the file and: +**Ignoring drawers:** The scan creates `ignore.txt` (at `ignore_file`, default `C:\Migration\ignore.txt`) if it doesn't exist and pre-fills it with every drawer in each clash group — searching those in FCCS can show a selection box that stalls the automation, so they're skipped by default. Open the file and: -- **Delete or comment out** any clash prefix you actually want exported (then handle it manually in FCCS). +- **Delete or comment out** any clashing drawer you actually want exported (then handle it manually in FCCS). - **Add** any other drawers to skip (e.g. password-protected folders), one ID per line. Re-running the scan never overwrites your edits — it only appends newly-discovered clashes. `drawer_ids.txt` stays a full inventory; the export skips anything active in the ignore list. Lines starting with `#` are comments. diff --git a/__pycache__/fccs_scan.cpython-313.pyc b/__pycache__/fccs_scan.cpython-313.pyc index b210fde..ec8de81 100644 Binary files a/__pycache__/fccs_scan.cpython-313.pyc and b/__pycache__/fccs_scan.cpython-313.pyc differ diff --git a/fccs_scan.py b/fccs_scan.py index 597e548..1299714 100644 --- a/fccs_scan.py +++ b/fccs_scan.py @@ -19,39 +19,45 @@ _IGNORE_HEADER = [ "#", "# Add password-protected or otherwise-excluded drawers here.", "#", - "# The IDs auto-added below are prefix clashes: searching them in FCCS", - "# pops a selection box that breaks the automation, so they're skipped by", - "# default. DELETE or comment out any you actually DO want exported (then", - "# handle them manually), and keep the rest.", + "# The IDs auto-added below are prefix clashes: searching any of them in", + "# FCCS can pop a selection box that breaks the automation, so ALL drawers", + "# in each clash group are skipped by default. DELETE or comment out any", + "# you actually DO want exported (then handle them manually), keep the rest.", "", ] def update_ignore_file(ignore_file, clashes, log): - """Create ignore.txt if missing and seed it with clash prefix IDs. + """Create ignore.txt if missing and seed it with clash-group IDs. - Never overwrites existing entries — only appends clash prefixes that - aren't already present. The shorter (prefix) ID of each clash is the one - that triggers the FCCS selection box, so it's the candidate to skip. - Returns the list of IDs that were added. + Every drawer involved in a clash (both the prefix and each longer ID that + matches it) is added, since any of them can trip the FCCS selection box. + Never overwrites existing entries — only appends IDs not already present, + and de-dupes so no ID is written twice. Returns the list of IDs added. """ existing = set(load_lines(ignore_file)) file_exists = os.path.exists(ignore_file) - to_add = [(short, matches) for short, matches in clashes - if short not in existing] + seen = set(existing) # never re-add anything already listed + blocks = [] # (comment, [new_ids]) to append, in clash order + for short, matches in clashes: + group = [short] + list(matches) + new_ids = [g for g in group if g not in seen] + if not new_ids: + continue + seen.update(new_ids) + blocks.append((f"# clash group: {', '.join(group)}", new_ids)) # Existing file already covers every clash — leave it untouched. - if file_exists and not to_add: + if file_exists and not blocks: return [] lines = [] if not file_exists: lines.extend(_IGNORE_HEADER) - - for short, matches in to_add: - lines.append(f"# clashes with: {', '.join(matches)}") - lines.append(short) + for comment, new_ids in blocks: + lines.append(comment) + lines.extend(new_ids) mode = "a" if file_exists else "w" with open(ignore_file, mode, encoding="utf-8") as f: @@ -59,11 +65,11 @@ def update_ignore_file(ignore_file, clashes, log): f.write("\n") # separate the new block from prior content f.write("\n".join(lines) + "\n") - added = [short for short, _ in to_add] + added = [i for _, ids in blocks for i in ids] if not file_exists: log(f"Created ignore file: {ignore_file}") if added: - log(f"Added {len(added)} clash prefix ID(s) to ignore list: " + log(f"Added {len(added)} clash-group ID(s) to ignore list: " f"{', '.join(added)}") return added