mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-14 13:27:09 +02:00
refactor(lyrics): retarget legacy callers to model.ParseLyrics
Pin suffix to ".lrc" to preserve byte-identical output for stored plain/LRC text that was previously handled by the now-removed ToLyrics.
This commit is contained in:
parent
ff1695d074
commit
cdbf63d5f4
2 changed files with 10 additions and 8 deletions
|
|
@ -46,12 +46,12 @@ func upAlterLyricColumn(ctx context.Context, tx *sql.Tx) error {
|
|||
continue
|
||||
}
|
||||
|
||||
lyrics, err := model.ToLyrics("xxx", lyrics.String)
|
||||
parsed, err := model.ParseLyrics(".lrc", "xxx", []byte(lyrics.String))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
text, err := json.Marshal(model.LyricList{*lyrics})
|
||||
text, err := json.Marshal(parsed)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,13 +205,14 @@ func (t Tags) Lyrics() string {
|
|||
basicLyrics := t.getAllTagValues("lyrics", "unsynced_lyrics", "unsynced lyrics", "unsyncedlyrics")
|
||||
|
||||
for _, value := range basicLyrics {
|
||||
lyrics, err := model.ToLyrics("xxx", value)
|
||||
parsed, err := model.ParseLyrics(".lrc", "xxx", []byte(value))
|
||||
if err != nil {
|
||||
log.Warn("Unexpected failure occurred when parsing lyrics", "file", t.filePath, "error", err)
|
||||
continue
|
||||
}
|
||||
|
||||
lyricList = append(lyricList, *lyrics)
|
||||
if main, ok := parsed.Main(); ok {
|
||||
lyricList = append(lyricList, main)
|
||||
}
|
||||
}
|
||||
|
||||
for tag, value := range t.Tags {
|
||||
|
|
@ -223,13 +224,14 @@ func (t Tags) Lyrics() string {
|
|||
}
|
||||
|
||||
for _, text := range value {
|
||||
lyrics, err := model.ToLyrics(language, text)
|
||||
parsed, err := model.ParseLyrics(".lrc", language, []byte(text))
|
||||
if err != nil {
|
||||
log.Warn("Unexpected failure occurred when parsing lyrics", "file", t.filePath, "error", err)
|
||||
continue
|
||||
}
|
||||
|
||||
lyricList = append(lyricList, *lyrics)
|
||||
if main, ok := parsed.Main(); ok {
|
||||
lyricList = append(lyricList, main)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue