Skip to content

ItsOnlyGame/my-spotify-playlist-sorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify playlist sorter

image

This script sorts your spotify playlist.

Sorting of the playlist follows these rules:

  1. Duplicate tracks will be removed.
  2. Tracks are sorted into groups of albums, that are ordered in the manner of the album.
  3. Albums are grouped by artist and release date. (Artist is determined from the album rather than the track)
  4. Artist groups are sorted depending on the first tracks appearance date on the playlist.

Automation

To automate this process, you may use any utility that you seem fit. The script has arguments that can so that it can automatically sort a playlist.

# Single playlist
python ./src/main.py --sort "playlist url here"

# Multiple playlists
python ./src/main.py --sort "playlist url here","another playlist url"

It executes the sorting with console output. Recommended tools for the automation process is pm2.

For some guidance on how to use pm2, see this

How to use

Requirements

  • Spotify API credentials (SPOTIPY_CLIENT_ID and SPOTIPY_CLIENT_SECRET)
  • Python 3
  • Pip dependencies in the requirements.txt file

Get started

Create a config.json file where the executable is.
Insert the spotify client id and secret like this:

{
  "SPOTIPY_CLIENT_ID": "INSERT CLIENT ID HERE",
  "SPOTIPY_CLIENT_SECRET": "INSERT CLIENT SECRET HERE"
}

Install dependencies by running this command
pip install -r requirements.txt

Start the script by running
python ./src/main.py


There is an option to clone an existing playlist. This can be used to test the script before applying any permanent sorting to your original playlist.

You can also run the python script with --debug argument. This will not apply any changes to the playlist, and will instead print out the sorted playlist to terminal.

python ./src/main.py --debug

About

Python script that sorts the tracks in your spotify playlist

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages