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:
Deluan 2026-06-19 14:46:43 -04:00
commit cdbf63d5f4
2 changed files with 10 additions and 8 deletions

View file

@ -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
}

View file

@ -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)
}
}
}
}