Skip to content

Creates a spotify list from an existing one, with tracks placed in a random order

License

Notifications You must be signed in to change notification settings

DanielHaitink/SpotifyRandomizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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. Optionally, you can give the program the Spotify username and the playlists to shuffle. 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["USER"] = "myusername"
      os.environ["PLAYLISTS"] = "Playlist1,Playlist2,Playlist3"
    2. Export those variables using your terminal. On windows:

      SET USER=myusername
      SET PLAYLISTS=Playlist1,Playlist2,Playlist3

      On linux:

      export USER=myusername
      export PLAYLISTS=Playlist1,Playlist2,Playlist3

      You only need to do this once.

  4. 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.

About

Creates a spotify list from an existing one, with tracks placed in a random order

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages