removed comment fix & moved comment fix to sort

This commit is contained in:
2026-05-07 15:20:52 +02:00
parent 8cdd2ed0ec
commit 978b7a319f
4 changed files with 23 additions and 110 deletions

View File

@@ -5,6 +5,7 @@ import (
"log/slog"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/dhowden/tag"
@@ -62,6 +63,8 @@ func readGenericAudioTags(filePath string) (*Metadata, error) {
Comment: &comment,
}
commentToSpotifyid(info)
return info, nil
}
@@ -89,3 +92,21 @@ func UpdateMetadata(src, dst string, m Metadata) error {
return nil
}
func commentToSpotifyid(m *Metadata) {
var re = regexp.MustCompile(`(?m)(https:\/\/open\.spotify\.com\/track\/)(.*)`)
if m.Comment == nil {
return
}
matches := re.FindAllStringSubmatch(*m.Comment, -1)
if len(matches) != 1 {
return
}
id := matches[0][2]
m.SpotifyID = &id
}