Super simple python program to update a duplicate of a Spotify playlist. Mostly for me to practice documenting projects on github. :)
Collaborative playlists cannot be added to your profile, so to share one of these playlists you must create a copy. However this copy will not be updated with new additions in the source playlist. This program can be deployed to Heroku or similar to update the playlist every hour or day etc.
Clone or download this repository and fill in the information at the top of the main.py script. The playlist URIs can no longer be copied directly from Spotify, however if you copy the link for the playlist, the URI will be the 22 characters after the last slash. Eg: htps://open.spotify.com/playlist/37i9dQZF1DX3Tjn540kLxZ
?si=3abbdc11b6434db1
src = '' # The source playlist URI
dst = '' # The destination playlist URI
username = '' # Your Spotify username
client_id = '' # Your Spotify app client id
client_secret = '' # And secret
redirect_uri = 'http://localhost:8000/' # The redirect url set on your Spotify app, must be identical!
removeFromDst = True; # Should songs ever be removed from the dst playlist if they are removed from the source. If true songs will be removed - mirror
The client id and secret can be created on Spotify's developer dashboard.
Then run the program with python3.
- Sign up for a Heroku account and create a new app.
- Follow the Deploy using Heroku Git instructions on the Heroku dashboard inside the folder for this repository. You will need the requirements.txt file for Heroku to recognise this build as python.
- Once you have deployed your app, go back to the Heroku dashboard and select configure add-ons under the overview section.
- Enter Heroku Scheduler in the search field and submit the order form.
- Next click on the Heroku scheduler link and create a job.
- Select your prefered time interval and enter
python main.py
as the command. This command can also be used from the Heroku console or command line to test your app