feat:(server): support reading lyrics from filesystem (#2897)

* simplified lyrics handling

* address initial feedback

* add some trace and error logging

* allow fallback lyrics

* update nit

* restore artist/title filter only
This commit is contained in:
Kendall Garner
2025-04-30 12:10:19 +00:00
committed by GitHub
parent 0d1f2bcc8a
commit ec9f9aa243
14 changed files with 391 additions and 13 deletions
+3 -1
View File
@@ -32,7 +32,7 @@ var (
// Should either be at the beginning of file, or beginning of line
syncRegex = regexp.MustCompile(`(^|\n)\s*` + timeRegexString)
timeRegex = regexp.MustCompile(timeRegexString)
lrcIdRegex = regexp.MustCompile(`\[(ar|ti|offset):([^]]+)]`)
lrcIdRegex = regexp.MustCompile(`\[(ar|ti|offset|lang):([^]]+)]`)
)
func (l Lyrics) IsEmpty() bool {
@@ -72,6 +72,8 @@ func ToLyrics(language, text string) (*Lyrics, error) {
switch idTag[1] {
case "ar":
artist = str.SanitizeText(strings.TrimSpace(idTag[2]))
case "lang":
language = str.SanitizeText(strings.TrimSpace(idTag[2]))
case "offset":
{
off, err := strconv.ParseInt(strings.TrimSpace(idTag[2]), 10, 64)