Adding Tracks To A Playlist

Wraps around this Spotify API endpoint

How to use

After creating a Spotify object, and getting a playlist through either .Playlists.GetPlaylist() or creating a new playlist with .Playlists.CreatePlaylist(), the .AddTrack() method of the returned playlist object can be used.

.AddTrack() expects one parameter, TrackIDOrTrackOBJ (Which can either be a track ID or a track object

Example

This example will:

A) Create a Spotify object (which will prompt the user for authorization if it is not already done)

B) Create a new (empty) playlist named Test 123 with the description This is an example playlist made by Spotify.ahk

C) Add a track to the new playlist with .AddTrack() by the track's Spotify ID

D) Will try to play the new playlist on the active device

Spoofy := new Spotify()
NewPlaylist := Spoofy.Playlists.CreatePlaylist("Test 123", "This is an example playlist made by Spotify.ahk")
NewPlaylist.AddTrack("5ogtb9bGQoH8CjZNxmbNHR")
NewPlaylist.Play()