From 40c5d1a316b0cc79bc37d13b63bc2452c24e231b Mon Sep 17 00:00:00 2001 From: tramhao Date: Wed, 3 Mar 2021 00:32:07 +0800 Subject: [PATCH] cleanLRC before embeding the lyric --- lyric/lrc.go | 1 + lyric/lyric_chinese.go | 1 + 2 files changed, 2 insertions(+) diff --git a/lyric/lrc.go b/lyric/lrc.go index 86e86b4..0be1793 100644 --- a/lyric/lrc.go +++ b/lyric/lrc.go @@ -136,6 +136,7 @@ func makeTime(h int, m int, s int, ms int) time.Time { // cleanLRC clean the string download func cleanLRC(s string) (cleanLyric string) { // Clean ' to ' + s = strings.ToValidUTF8(s, " ") s = strings.Replace(s, "'", "'", -1) // It's wierd that sometimes there are two ajacent ''. // Replace it anyway diff --git a/lyric/lyric_chinese.go b/lyric/lyric_chinese.go index abbfd42..0afeaf7 100644 --- a/lyric/lyric_chinese.go +++ b/lyric/lyric_chinese.go @@ -99,6 +99,7 @@ func GetLyricChinese(lyricID string, serviceProvider string) (string, error) { // file.Close() // } if looksLikeLRC(lyric) { + lyric = cleanLRC(lyric) return lyric, nil } return "", fmt.Errorf("lyric not compatible")