Xil Sfx Mp3 Crosscheck
tools.xil_sfx_mp3_crosscheck
xil_sfx_mp3_crosscheck.py — cross-check sfx_
Lives in tools/; run from anywhere: python3 tools/xil_sfx_mp3_crosscheck.py
Scans every configs//sfx_
Only explicit "source" fields are treated as references. Effects with no "source" (prompt-generated sfx/silence, landing under a slug-derived filename computed at generation time) are NOT resolved back to a filename here — see sfx_common.py's shared_sfx_path()/ ensure_shared_sfx() if that reverse-mapping is ever needed. This means some "unreferenced" files may in fact be in active use via the slug-derived naming path; treat the unreferenced list as candidates for review, not a deletion list.
Output
- CSV at $XIL_PROJECTROOT/sfx_mp3_crosscheck.csv, one row per SFX/*.mp3 file, columns: mp3_path, referenced, show, tag, config_path, declared_source. A referenced file that is reused by multiple show/tag configs gets one row per (file, show, tag) reference.
- Control totals to stdout: total mp3 files on disk, total distinct files referenced, total unreferenced, total declared sources found across all configs, and how many of those sources failed to resolve to a file on disk (dangling references).
find_sfx_configs
Return all sfx_*.json files anywhere under configs_dir, sorted.
find_mp3_files
Return all .mp3 files anywhere under sfx_dir, sorted.
resolve_source
Resolve a config's declared source path the way sfx_common.py does: relative paths are resolved against the workspace root, not the config file's own directory or the CWD.
Uses purely lexical normalization (no filesystem syscalls) — this project's SFX/ tree lives on a slow network/WSL mount where os.path.realpath() on every file is prohibitively slow, and no symlinks are expected here.
Source code in tools/xil_sfx_mp3_crosscheck.py
show_and_tag_from_config_path
Derive (show, tag) from a config path like configs/
Source code in tools/xil_sfx_mp3_crosscheck.py
main
Source code in tools/xil_sfx_mp3_crosscheck.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |