Giter Club home page Giter Club logo

my-spotify-playlist-sorter's Introduction

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

my-spotify-playlist-sorter's People

Contributors

itsonlygame avatar jmw182 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jmw182 tokwyoo

my-spotify-playlist-sorter's Issues

Spotify null tracks

Apparently it is possible to add "null" tracks to your playlists. This causes the sorting to fail.

I managed to produce this by selecting every item from a prerelease album where not all the tracks have been released yet.
E.g. Twenty One Pilots - Clancy (11.4.2024)

Removed user id data for privacy reasons

    {
      "added_at": "2024-03-27T14:16:47Z",
      "added_by": {
        "external_urls": {
          "spotify": ""
        },
        "href": "",
        "id": "",
        "type": "user",
        "uri": ""
      },
      "is_local": false,
      "track": null,
      "primary_color": null,
      "video_thumbnail": {
        "url": null
      }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.