From 1656721cb93739f3cb967549c2688fe441039ed8 Mon Sep 17 00:00:00 2001 From: itouakirai <85016486+itouakirai@users.noreply.github.com> Date: Sun, 18 Aug 2024 23:02:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=90=E5=AD=97=E6=AD=8C?= =?UTF-8?q?=E8=AF=8D=E8=A1=8C=E5=BC=80=E5=A4=B4=E4=B8=BA=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 731db3b..df7432d 100644 --- a/main.go +++ b/main.go @@ -1856,9 +1856,13 @@ func conventSyllableTTMLToLRC(ttml string) (string, error) { for _, div := range parsedTTML.FindElement("tt").FindElement("body").FindElements("div") { for _, item := range div.ChildElements() { var lrcSyllables []string + var i int = 0 for _, lyrics := range item.Child { if _, ok := lyrics.(*etree.CharData); ok { - lrcSyllables = append(lrcSyllables, " ") + if i > 0 { + lrcSyllables = append(lrcSyllables, " ") + continue + } continue } lyric := lyrics.(*etree.Element) @@ -1884,6 +1888,7 @@ func conventSyllableTTMLToLRC(ttml string) (string, error) { text = lyric.SelectAttr("text").Value } lrcSyllables = append(lrcSyllables, fmt.Sprintf("%s%s", beginTime, text)) + i += 1 } endTime, err := parseTime(item.SelectAttr("end").Value) if err != nil {