Python scripts leveraging the Spotify Web API to offset my laziness when making playlists. A wrapper for the Spotify (spotipy) API was used
You will need to set the tool up in your spotify developer profile to grab your SPOTIPY_CLIENT_ID and SPOTIPY_CLIENT_SECRET.
The following environment variables are also required;
- SPOTIPY_CLIENT_ID: Taken from the Spotify Developer Dashboard (detals below)
- SPOTIPY_CLIENT_SECRET: Taken from the Spotify Developer Dashboard (detals below)
- SPOTIPY_REDIRECT_URI: http://localhost/ is sufficient when using spotipy (which we are)
Details around spotipy authorisation can be found here.
When running the app for the first time, the auth from the API will display:
Enter the URL you were redirected to:
Your preferred browser should pop-up, log in to your Spotify account and then paste the URL it brings you to into your command line, it will look something like:
http://localhost/?code=[...]
If using WSL and not seeing a pop-up, try setting the environment variable "BROWSER=wslview"
python3
python-pip packages can be found in requirements.txt
The following assumes the Authentication environment variables mentioned above are set.
docker build --build-arg SPOTIPY_CLIENT_ID=${SPOTIPY_CLIENT_ID} --build-arg SPOTIPY_CLIENT_SECRET=${SPOTIPY_CLIENT_SECRET} --build-arg SPOTIPY_REDIRECT_URI=${SPOTIPY_REDIRECT_URI} -t spotipy_image --rm .
pip install --editable .
docker run spotipy_image setlist_to_playlist --setlist <setlist.fm_url> --id <spotify_user_id>
spotipy-utils setlist_to_playlist --setlist <setlist.fm_url> --id <spotify_user_id>
https://www.setlist.fm/setlist/muse/2004/worthy-farm-pilton-england-63d7a6f3.html
Creates 3 playlists, top songs based on long term, medium term and short term time period.
docker run spotipy_image top_tracks_to_playlist --id <spotify_user_id>
spotipy-utils top_tracks_to_playlist --id <spotify_user_id>
./utils/genre_to_playlist.py u