style: clean url recognition

This commit is contained in:
2026-02-13 15:57:56 +01:00
parent 04cd63c501
commit 7ea1ba4b5c
2 changed files with 31 additions and 5 deletions

25
pkg/utils.go Normal file
View File

@@ -0,0 +1,25 @@
package pkg
import (
"strings"
)
type UrlType int
const (
UrlTypeTrack UrlType = iota
UrlTypePlaylist
UrlTypeInvalid
)
func GetUrlType(url string) UrlType {
if strings.Contains(url, "https://open.spotify.com/track") {
return UrlTypeTrack
}
if strings.Contains(url, "https://open.spotify.com/playlist") {
return UrlTypePlaylist
}
return UrlTypeInvalid
}