refactor(lyrics): consolidate lyrics parsing functions names

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2026-06-19 18:01:10 -04:00
parent e8a404ac76
commit 48c0173e81
5 changed files with 6 additions and 6 deletions

View file

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

View file

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

View file

@ -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() {

View file

@ -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(`<?xml$1encoding="UTF-8"$2?>`))
// Skip non-TTML content so sniffing doesn't run the full TTML parse on plain

View file

@ -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() {