No description
Find a file
2025-08-31 18:24:03 +03:00
.vscode Update .vscode settings 2024-02-20 16:48:59 +02:00
github Added preview image for github 2024-01-03 16:31:23 +02:00
src fix(sorter): invalid use of playlist_remove_specific_occurrences_of_items 2024-05-25 15:13:40 +03:00
.gitattributes Add .gitattributes file 2024-04-03 16:39:53 +03:00
.gitignore Updated gitignore 2023-12-28 17:46:25 +02:00
config_example.json Added config example 2023-12-28 17:46:33 +02:00
LICENSE Updated LICENSE 2022-09-20 01:32:37 +03:00
README.md docs: update repository status in README 2025-08-31 18:24:03 +03:00
requirements.txt Removed Windows exe building 2024-02-01 17:03:19 +02:00

Spotify playlist sorter (Archived)

image

Repository status

An active version can be found here. It is written in Go.

Overview

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