Xilp008 Stale Stem Cleanup
src.xil_pipeline.XILP008_stale_stem_cleanup
Remove stale stems left behind after a parsed script revision.
After running XILP007 (stem migrator), the stems directory may contain files whose seq numbers now map to a different entry type in the current parsed JSON. This script finds those mismatches and deletes them.
Usage:
python XILP008_stale_stem_cleanup.py --episode S02E03 --dry-run
python XILP008_stale_stem_cleanup.py --episode S02E03
python XILP008_stale_stem_cleanup.py --parsed parsed/parsed_<slug>_S02E03.json --stems stems/S02E03 [--dry-run]
find_stale_stems
Return a list of (filepath, seq, reason) for stale stems.
A stem is stale when
_sfxsuffix but the entry is nowdialogue- speaker suffix (not
_sfx) but the entry is nowdirection - dialogue stem whose speaker suffix doesn't match the parsed speaker
- seq number not present in the parsed JSON at all
- duplicate: multiple stems share the same seq; only the one matching the expected basename survives
Source code in src/xil_pipeline/XILP008_stale_stem_cleanup.py
get_parser
Source code in src/xil_pipeline/XILP008_stale_stem_cleanup.py
main
CLI entry point for stale stem cleanup.