Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.62 KB

README.md

File metadata and controls

54 lines (38 loc) · 2.62 KB

SpotifyRandomizer

Truly randomize your Spotify playlists. This program creates a Spotify playlist from an existing one, with it's tracks placed in a random order, saved under a new name.

image * An example of running the program.

image * The web server after authenticating. This only needs to be done once (per user).

Required packages

To use SpotifyRandomizer, you need spotipy. You can install it using pip: pip3 install spotipy

Setup

  1. Create a spotify application so you can use spotipy. You can do this at the Spotify developer website.

  2. Now you need to give the program your client ID & client secret. You can do this in 2 ways:

    1. Uncomment the lines in randomizer.py (by removing the # in the beginning of the line) that set these variables and inputting yours.

      os.environ["SPOTIPY_CLIENT_ID"] = "myclientid"
      os.environ["SPOTIPY_CLIENT_SECRET"] = "myclientsecret"
    2. Export those variables using your terminal. On windows:

      SET SPOTIPY_CLIENT_ID=myclientid
      SET SPOTIPY_CLIENT_SECRET=myclientsecret

      On linux:

      export SPOTIPY_CLIENT_ID=myclientid
      export SPOTIPY_CLIENT_SECRET=myclientsecret

      You only need to do this once.

    The default redirect URL is http://localhost:14523 for the local webserver.

  3. You're done - you can basically change anything else you'd like.

Run

The script can be ran by doing python3 main.py. In this case the program will ask you for your username and playlist(s) while running. You can also give that information as an argument, like this python3 main.py 1234567890 Playlist1 Playlist2 Playlist3

The playlists can be the name of the playlist or the ID of the playlist (found in the URL). These playlists have to be owned by you.

When you run the program for the first time, it will open the spotify website for authorization. Then you need to copy the redirected URL into the commandline. After this, the program should work.

Other

Also check out the repo SpotifyNoDupes if you want to get rid of your duplicate songs in playlists.