mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-26 13:49:21 +08:00
cleanLRC before embeding the lyric
This commit is contained in:
parent
5122ed3213
commit
40c5d1a316
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user