tweaked the ignore list so it includes all files not just prefix, so 02800 and 02800TP now
This commit is contained in:
@@ -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:
|
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.
|
- **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.
|
- **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.
|
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.
|
||||||
|
|||||||
Binary file not shown.
42
fccs_scan.py
42
fccs_scan.py
@@ -19,39 +19,45 @@ _IGNORE_HEADER = [
|
|||||||
"#",
|
"#",
|
||||||
"# Add password-protected or otherwise-excluded drawers here.",
|
"# Add password-protected or otherwise-excluded drawers here.",
|
||||||
"#",
|
"#",
|
||||||
"# The IDs auto-added below are prefix clashes: searching them in FCCS",
|
"# The IDs auto-added below are prefix clashes: searching any of them in",
|
||||||
"# pops a selection box that breaks the automation, so they're skipped by",
|
"# FCCS can pop a selection box that breaks the automation, so ALL drawers",
|
||||||
"# default. DELETE or comment out any you actually DO want exported (then",
|
"# in each clash group are skipped by default. DELETE or comment out any",
|
||||||
"# handle them manually), and keep the rest.",
|
"# you actually DO want exported (then handle them manually), keep the rest.",
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def update_ignore_file(ignore_file, clashes, log):
|
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
|
Every drawer involved in a clash (both the prefix and each longer ID that
|
||||||
aren't already present. The shorter (prefix) ID of each clash is the one
|
matches it) is added, since any of them can trip the FCCS selection box.
|
||||||
that triggers the FCCS selection box, so it's the candidate to skip.
|
Never overwrites existing entries — only appends IDs not already present,
|
||||||
Returns the list of IDs that were added.
|
and de-dupes so no ID is written twice. Returns the list of IDs added.
|
||||||
"""
|
"""
|
||||||
existing = set(load_lines(ignore_file))
|
existing = set(load_lines(ignore_file))
|
||||||
file_exists = os.path.exists(ignore_file)
|
file_exists = os.path.exists(ignore_file)
|
||||||
|
|
||||||
to_add = [(short, matches) for short, matches in clashes
|
seen = set(existing) # never re-add anything already listed
|
||||||
if short not in existing]
|
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.
|
# Existing file already covers every clash — leave it untouched.
|
||||||
if file_exists and not to_add:
|
if file_exists and not blocks:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
if not file_exists:
|
if not file_exists:
|
||||||
lines.extend(_IGNORE_HEADER)
|
lines.extend(_IGNORE_HEADER)
|
||||||
|
for comment, new_ids in blocks:
|
||||||
for short, matches in to_add:
|
lines.append(comment)
|
||||||
lines.append(f"# clashes with: {', '.join(matches)}")
|
lines.extend(new_ids)
|
||||||
lines.append(short)
|
|
||||||
|
|
||||||
mode = "a" if file_exists else "w"
|
mode = "a" if file_exists else "w"
|
||||||
with open(ignore_file, mode, encoding="utf-8") as f:
|
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") # separate the new block from prior content
|
||||||
f.write("\n".join(lines) + "\n")
|
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:
|
if not file_exists:
|
||||||
log(f"Created ignore file: {ignore_file}")
|
log(f"Created ignore file: {ignore_file}")
|
||||||
if added:
|
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)}")
|
f"{', '.join(added)}")
|
||||||
return added
|
return added
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user