mirror of
https://github.com/Superredstone/spotiflac-cli.git
synced 2026-03-07 20:18:07 +01:00
feat: improve metadata implementation for track
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user