mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-15 13:17:25 +00:00
Accept spec lyrics_source values (authored, transcribed)
The feedpak spec (§7.1) defines the lyrics_source vocabulary as {authored, transcribed, user}, but the reader only accepted the legacy {xml, notechart, whisperx, user} set and silently downgraded anything else to "xml". A spec-compliant writer (e.g. the stem_splitter plugin, which emits transcribed for WhisperX-produced lyrics) therefore lost its provenance badge.
Widen the allowed set to the union of the spec vocabulary and the legacy values so both validate, and alias the legacy whisperx engine name to the spec transcribed so existing packs normalise to the spec badge.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: topkoa <topkoa@gmail.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
612b1f2e0d
commit
33146cc7f6
+23
-14
@@ -703,20 +703,29 @@ def load_song(
|
|||||||
and isinstance(e.get("d"), (int, float))
|
and isinstance(e.get("d"), (int, float))
|
||||||
]
|
]
|
||||||
if song.lyrics:
|
if song.lyrics:
|
||||||
# Provenance — populated by the converter (xml/notechart),
|
# Provenance. The feedpak spec (§7.1) vocabulary is
|
||||||
# the WhisperX fallback (whisperx), or hand-edits
|
# {authored, transcribed, user}; older manifests + the
|
||||||
# (user). Validate against the closed enum so a
|
# in-tree readers also use the source-format names
|
||||||
# hand-edited (or otherwise malformed) manifest can't
|
# (xml/notechart) and the WhisperX engine name
|
||||||
# propagate a YAML dict / list / arbitrary string
|
# (whisperx). Accept the union so both spec-compliant
|
||||||
# into the highway WS `lyrics.source` field and out
|
# writers (e.g. the stem_splitter plugin emitting
|
||||||
# to plugin badges. Anything outside the enum (or
|
# `transcribed`) and legacy packs validate. Validate
|
||||||
# the wrong type) falls back to "xml" — the spec's
|
# against the closed enum so a hand-edited (or otherwise
|
||||||
# back-compat default — instead of being stringified
|
# malformed) manifest can't propagate a YAML dict / list /
|
||||||
# and trusted.
|
# arbitrary string into the highway WS `lyrics.source`
|
||||||
_ALLOWED_LYRICS_SOURCES = {"xml", "notechart", "whisperx", "user"}
|
# field and out to plugin badges. Anything outside the
|
||||||
# Legacy alias: older manifests labelled note-chart-derived
|
# enum (or the wrong type) falls back to "xml" — the
|
||||||
# lyrics with the source format's name; normalise it.
|
# back-compat default — instead of being stringified and
|
||||||
_LYRICS_SOURCE_ALIASES = {"sng": "notechart"}
|
# trusted.
|
||||||
|
_ALLOWED_LYRICS_SOURCES = {
|
||||||
|
"xml", "notechart", "whisperx", "user",
|
||||||
|
"authored", "transcribed",
|
||||||
|
}
|
||||||
|
# Legacy aliases: older manifests labelled note-chart-derived
|
||||||
|
# lyrics with the source format's name, and the WhisperX
|
||||||
|
# fallback with the engine name — normalise both to the
|
||||||
|
# spec vocabulary the badges now expect.
|
||||||
|
_LYRICS_SOURCE_ALIASES = {"sng": "notechart", "whisperx": "transcribed"}
|
||||||
raw_source = manifest.get("lyrics_source")
|
raw_source = manifest.get("lyrics_source")
|
||||||
if isinstance(raw_source, str):
|
if isinstance(raw_source, str):
|
||||||
raw_source = _LYRICS_SOURCE_ALIASES.get(raw_source, raw_source)
|
raw_source = _LYRICS_SOURCE_ALIASES.get(raw_source, raw_source)
|
||||||
|
|||||||
Reference in New Issue
Block a user