extract_tags() in dataset_processing/pre_encode.py fails to find caption
sidecars when they're kept in a sibling txt/ or json/ subfolder next to
the audio (the layout documented in the README, e.g. my-songs/01.wav +
my-songs/json/01.json). The lookup path is built one level too high, so it
never finds them.
Where
dataset_processing/pre_encode.py, inside extract_tags():
pythonsidecar_candidates = [
fp.with_suffix(".json"),
fp.parent.parent / "json" / (stem + ".json"), # <-- bug
]
...
txt_candidates = [
fp.with_suffix(".txt"),
fp.parent.parent / "txt" / (stem + ".txt"), # <-- same bug
]
fp.parent is already the audio file's own folder (e.g. my-songs/).
.parent.parent steps out one more level, so for my-songs/01.wav it
looks for captions in /json/01.json /
/txt/01.txt instead of my-songs/json/01.json /
my-songs/txt/01.txt — which is exactly the layout the docstring and README
describe.
The same-directory case (fp.with_suffix(".json") / .with_suffix(".txt"))
is unaffected; only the sibling-subfolder fallback is broken.
Repro
my-songs/
01.wav
json/01.json # never found — code looks one level above my-songs/ instead
extract_tags("my-songs/01.wav") falls straight through to embedded
ID3/Vorbis tags (or returns {}), silently skipping the JSON/txt captions.
Fix
Use fp.parent instead of fp.parent.parent for both sibling-subfolder
candidates:
pythonsidecar_candidates = [
fp.with_suffix(".json"),
fp.parent / "json" / (stem + ".json"),
]
...
txt_candidates = [
fp.with_suffix(".txt"),
fp.parent / "txt" / (stem + ".txt"),
]
Happy to open a PR with this change if useful — it's a 2-line fix, verified
locally against both a flat my-songs/json/... layout and a nested
my-songs//json/... layout.
extract_tags() in dataset_processing/pre_encode.py fails to find caption
sidecars when they're kept in a sibling txt/ or json/ subfolder next to
the audio (the layout documented in the README, e.g. my-songs/01.wav +
my-songs/json/01.json). The lookup path is built one level too high, so it
never finds them.
Where
dataset_processing/pre_encode.py, inside extract_tags():
pythonsidecar_candidates = [
fp.with_suffix(".json"),
fp.parent.parent / "json" / (stem + ".json"), # <-- bug
]
...
txt_candidates = [
fp.with_suffix(".txt"),
fp.parent.parent / "txt" / (stem + ".txt"), # <-- same bug
]
fp.parent is already the audio file's own folder (e.g. my-songs/).
.parent.parent steps out one more level, so for my-songs/01.wav it
looks for captions in /json/01.json /
/txt/01.txt instead of my-songs/json/01.json /
my-songs/txt/01.txt — which is exactly the layout the docstring and README
describe.
The same-directory case (fp.with_suffix(".json") / .with_suffix(".txt"))
is unaffected; only the sibling-subfolder fallback is broken.
Repro
my-songs/
01.wav
json/01.json # never found — code looks one level above my-songs/ instead
extract_tags("my-songs/01.wav") falls straight through to embedded
ID3/Vorbis tags (or returns {}), silently skipping the JSON/txt captions.
Fix
Use fp.parent instead of fp.parent.parent for both sibling-subfolder
candidates:
pythonsidecar_candidates = [
fp.with_suffix(".json"),
fp.parent / "json" / (stem + ".json"),
]
...
txt_candidates = [
fp.with_suffix(".txt"),
fp.parent / "txt" / (stem + ".txt"),
]
Happy to open a PR with this change if useful — it's a 2-line fix, verified
locally against both a flat my-songs/json/... layout and a nested
my-songs//json/... layout.