mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
fix: guarantee main-first cueLine ordering for same index
Add stable sort to ensure the main vocals cueLine (empty role) always appears before other roles when multiple cueLines share the same line index. Previously relied on source document order which is not guaranteed across all TTML files.
This commit is contained in:
parent
0f5b2877bf
commit
1f9fb113f7
@ -513,6 +513,11 @@ func buildStructuredLyric(mf *model.MediaFile, lyrics model.Lyrics, enhanced boo
|
||||
})
|
||||
}
|
||||
|
||||
// Ensure main vocals (empty role) always comes first
|
||||
sort.SliceStable(roleOrder, func(i, j int) bool {
|
||||
return roleOrder[i] == "" && roleOrder[j] != ""
|
||||
})
|
||||
|
||||
// Create a separate CueLine for each role group
|
||||
for _, role := range roleOrder {
|
||||
cues := cuesByRole[role]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user