Install spotipy with pip:
pip install spotipy
Create a Spotify developer app. Once created, edit the redirect URL (in "Edit Settings") to be http://localhost
.
To run the script, you will need to set the following environmental variables:
export SPOTIPY_CLIENT_ID="your-spotify-client-id"
export SPOTIPY_CLIENT_SECRET="your-spotify-client-secret"
export SPOTIPY_REDIRECT_URI="http://localhost"
You may do this manually or use something like an Anaconda environment so that this does not need to be set each time. You can follow these instructions for the latter approach.
Now you can run the script by simply running python songloop.py
! It will prompt you for the spotify URI and the times over which to loop, and you should be good to go :)