feat: improve metadata implementation for track

This commit is contained in:
2026-02-17 11:18:53 +01:00
parent 5b557f1b1f
commit 1504e29919
4 changed files with 140 additions and 50 deletions

View File

@@ -10,19 +10,18 @@ type UrlType int
const (
UrlTypeTrack UrlType = iota
UrlTypePlaylist
UrlTypeInvalid
)
func ParseUrlType(url string) UrlType {
func ParseUrlType(url string) (UrlType, error) {
if strings.Contains(url, "https://open.spotify.com/track") {
return UrlTypeTrack
return UrlTypeTrack, nil
}
if strings.Contains(url, "https://open.spotify.com/playlist") {
return UrlTypePlaylist
return UrlTypePlaylist, nil
}
return UrlTypeInvalid
return UrlTypeTrack, errors.New("Invalid URL, not a playlist nor a track.")
}
func ParseTrackId(url string) (string, error) {