A script to organise my Spotify library based on my saved albums.
As I grew up with CDs, I'm very old-fashioned in the way I listen to music: one album at a time, listening to all the tracks...
Spotify is great but the different sections of the library are completely disconnected: when I discover a new album and save it to my library, the tracks are not automatically saved to my "Liked Songs", and the artist is not automatically followed.
This Python script fetches all the albums currently saved in the user's library. For each album it will:
- Make sure that all the album's tracks are saved in the "Liked Songs" playlist
- Make sure that the album's creators are added to the "Followed Artists"
Finally, the script cleans up the "Liked Songs" and "Followed Artists" by removing any tracks/artists that are not in the currently saved albums.
- A Spotify account
- Python 3
- Create an OAuth app to authenticate with the Spotify API: a. Go to https://developer.spotify.com/dashboard b. Click "Create App" c. Fill in the form. For "Redirect URI", simply use "http://localhost/" d. Get your client id and client secret
- Copy the
.env.examplefile in this repository to create your.env. Fill in the values forSPOTIPY_CLIENT_IDandSPOTIPY_CLIENT_SECRETwith the values you obtained in the previous step. - Start the script:
python3 spotify_library_organiser.py. If you're running the script for the first time, it will open your browser so you can authorise its access to your Spotify account.
