Skip to content

Marking an album as "Liked ❤️" no longer adds all album tracks to your Liked Songs list. This script looks at your Liked albums and ensures that all tracks are also Liked.

License

Notifications You must be signed in to change notification settings

dougthor42/spotify-favorites-fixer

Repository files navigation

Spotify Favorites Fixer

At some point in the past few years, Spotify changed how they handle the "Liking" ("Favoriting") of songs and albums. Previously, if you "Liked" ❤️ an album, all tracks in that album would also be "Liked" ❤️ and added to your "Liked Songs" list.

Nowadays, that's no longer the case: "Liking" an album simply adds it to Your Library --> Albums and does nothing to the "Liked Songs" list.

I really dislike (ha!) this change, so I've finally decided to do something about it.

This simple script will query all of your "Liked" albums and then mark each track as "Liked" as well.

Sure, it's got it's downsides - if you "Un-Like" a track from a "Liked" album, this script will "Re-Like" it for you. But that's something we just deal with.

Also, Semantic Satiation of "Like"...

Settings Things Up

  1. Make sure you have a Spotify Developer account.
  2. Create an App. Any name is fine.
  3. Add http://127.0.0.1:9090 as a Redirect URI on the App.
  4. Add your client ID and client secret into .\secrets.sh:
    export SPOTIPY_CLIENT_ID="<client_id>"
    export SPOTIPY_CLIENT_SECRET="<client_secret>"
    export SPOTIPY_REDIRECT_URI="http://127.0.0.1:9090"
  5. Source that file: source secrets.sh

Installation

  1. Clone the repo.
  2. Make a venv and activate it.
  3. Install: pip install -e .

Development

Do the 3 steps above, and then:

  1. Install dev dependencies: pip install -e .[develop]
  2. Install pre-commit hooks: pre-commit install
  3. Run tests if you want: pytest

Usage

If you've done Settings Things Up and Installation then you should be able to just call:

python fix_spotify_favorites.py

❗ It's recommended to run with -n/--dry-run first!

A browser window will pop up asking for authorization to access your data. Give it the A-OK and the script will do its thing.

Authorization will last for... some amount of time. Maybe a day? I donno, I haven't tested yet. During the active auth period, re-running the program will not pop up the browser window.

Errors

Refresh Token Revoked

If you get

spotipy.oauth2.SpotifyOauthError: error: invalid_grant, error_description: Refresh token revoked

then you might have changed your Spotify password since you last ran this program.

Delete ./.cache and try again.

CLI

View the CLI args/help with python fix_spotify_favorites.py --help.

Skiplisting Tracks

Sometimes there are tracks that you intentionally "un-like". These can be added to a file and then fix_spotify_favorites will not re-like it.

The skiplist file is a CSV file (named "skiplist.csv" by default). The file must have the following properties:

  • column names on row 1
  • have a column called spotify_id which is the ID of the track to skip
  • use commas as a column delimiter (if multitple columns are present)

All other columns, along with ordering, are ignored so you can use them for your own notes or whatever.

For example, these are all valid and equivalent skiplist files.

spotify_id,artist,track
6DZLcTwul48FE4aW0xSxbl,Sublime,Raleigh Soliloquy Pt. I
62oXSkYi2CJAz1hoJAvGN0,Sublime,Raleigh Soliloquy Pt. II
3ZBUmaRN1hitj5L0pJTifL,Wicked,No Good Deed (German)
reason,spotify_id,track
"Foo",6DZLcTwul48FE4aW0xSxbl,"Trackname 1"
"Bar",62oXSkYi2CJAz1hoJAvGN0,"Raleigh Soliloquy Pt. II"
"It's in German, man.",3ZBUmaRN1hitj5L0pJTifL,No Good Deed
spotify_id
6DZLcTwul48FE4aW0xSxbl
62oXSkYi2CJAz1hoJAvGN0
3ZBUmaRN1hitj5L0pJTifL

Other

This was built on Python 3.8 and should run on any higher versions.

It uses the Spotipy library and uses the Authorization Code Flow.

Only tested on Linux (WSL) Ubuntu 20.04.

About

Marking an album as "Liked ❤️" no longer adds all album tracks to your Liked Songs list. This script looks at your Liked albums and ensures that all tracks are also Liked.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages