From 48c0173e81cc11a170af5a0f7fe9b776552da1dd Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 19 Jun 2026 18:01:10 -0400 Subject: [PATCH] refactor(lyrics): consolidate lyrics parsing functions names Signed-off-by: Deluan --- model/lyrics_parse.go | 4 ++-- model/lyrics_srt.go | 2 +- model/lyrics_srt_test.go | 2 +- model/lyrics_ttml.go | 2 +- model/lyrics_ttml_test.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model/lyrics_parse.go b/model/lyrics_parse.go index 13eabd9fa..4bfaa29e8 100644 --- a/model/lyrics_parse.go +++ b/model/lyrics_parse.go @@ -20,8 +20,8 @@ var lyricFormats = []struct { suffixes []string parse lyricParser }{ - {[]string{".ttml"}, parseTTMLWithDefaultLang}, - {[]string{".srt"}, parseSRTWithLanguage}, + {[]string{".ttml"}, parseTTML}, + {[]string{".srt"}, parseSRT}, {[]string{".yaml", ".yml"}, parseLyricsfile}, } diff --git a/model/lyrics_srt.go b/model/lyrics_srt.go index ff61d746b..319a59961 100644 --- a/model/lyrics_srt.go +++ b/model/lyrics_srt.go @@ -13,7 +13,7 @@ var ( srtBlockSeparatorRegex = regexp.MustCompile(`\n\s*\n`) ) -func parseSRTWithLanguage(language string, contents []byte) (LyricList, error) { +func parseSRT(language string, contents []byte) (LyricList, error) { raw := strings.ReplaceAll(string(contents), "\r\n", "\n") raw = strings.ReplaceAll(raw, "\r", "\n") diff --git a/model/lyrics_srt_test.go b/model/lyrics_srt_test.go index 5e2de991f..385c04fb6 100644 --- a/model/lyrics_srt_test.go +++ b/model/lyrics_srt_test.go @@ -7,7 +7,7 @@ import ( // parseSRT parses with the default placeholder language, for test ergonomics. func parseSRT(contents []byte) (LyricList, error) { - return parseSRTWithLanguage("xxx", contents) + return parseSRT("xxx", contents) } var _ = Describe("parseSRT", func() { diff --git a/model/lyrics_ttml.go b/model/lyrics_ttml.go index 45e1d5725..95aab3485 100644 --- a/model/lyrics_ttml.go +++ b/model/lyrics_ttml.go @@ -115,7 +115,7 @@ func isTTMLDocument(contents []byte) bool { } } -func parseTTMLWithDefaultLang(defaultLang string, contents []byte) (LyricList, error) { +func parseTTML(defaultLang string, contents []byte) (LyricList, error) { contents = xmlEncodingRegex.ReplaceAll(contents, []byte(``)) // Skip non-TTML content so sniffing doesn't run the full TTML parse on plain diff --git a/model/lyrics_ttml_test.go b/model/lyrics_ttml_test.go index c9d9e193f..461d4eb30 100644 --- a/model/lyrics_ttml_test.go +++ b/model/lyrics_ttml_test.go @@ -7,7 +7,7 @@ import ( // parseTTML parses with the default placeholder language, for test ergonomics. func parseTTML(contents []byte) (LyricList, error) { - return parseTTMLWithDefaultLang("xxx", contents) + return parseTTML("xxx", contents) } var _ = Describe("parseTTML", func() {