feat: add playlist download

This commit is contained in:
2026-02-20 08:05:05 +01:00
parent 777fab8c9a
commit e4083c65c0
3 changed files with 86 additions and 8 deletions

View File

@@ -15,6 +15,10 @@ const (
UrlTypePlaylist
)
const (
BASE_SPOTIFY_TRACK_URL = "https://open.spotify.com/track/"
)
func ParseUrlType(url string) (UrlType, error) {
if strings.Contains(url, "https://open.spotify.com/track") {
return UrlTypeTrack, nil
@@ -131,3 +135,13 @@ func (app *App) InitSpotifyClient() error {
return nil
}
func SpotifyUriToLink(uri string) (string, error) {
spotifyId := strings.Split(uri, ":")
if len(spotifyId) != 3 {
return "", errors.New("Invalid URI parsed.")
}
return BASE_SPOTIFY_TRACK_URL + spotifyId[2], nil
}