Skip to content

GusVieweg/spotify-splitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify Splitter

Goals and Purpose

Addie and I have created a large playlist of all the tunes we currently like.

Oftentimes, we will want to put on a mood - currently either bops or softs.

Bops are for when things are good. The kids call them bangers. Think a boisterous Friday evening.

Softs are for when things are mellow. The kids call them chill tunes. Think a hungover sleepy Saturday morning.

There was no way for us to put on one mood of songs we currently like. We had to skip softs when we were in a bop mood and bops when we were in a soft mood.

Enter Spotify Splitter.

Methodology

Spotify Splitter splits a large playlist into bops and softs based on a separation algorithm.

Spotify characterizes all of their songs with various criteria called Audio Features.

Using these, we can run each song through a filter to determine if it is a bop, a soft, both, or neither.

A rudimentary, pseudocode filter may look like:

if song['danceability'] > 0.7:
    bops.add(song)
if song['energy'] < 0.45:
    softs.add(song)

The current sorting algorithm can be found on the spotify-splitter.py file.

Deployment

To run this on your own playlists:

  1. Go to your Spotify for Developers Dashboard (SfDD).
  2. Create an account if needed.
  3. Create a new app and call it "Spotify Splitter."
  4. Edit the "Spotify Splitter" app's settings and add an entry to "Redirect URIs": http://localhost:8080/. Be sure to save!
  5. Create a .env in the base spotify-splitter/ folder with the following environment variables:
  • SPOTIFY_CLIENT_ID: your client id from the SfDD
  • SPOTIFY_CLIENT_SECRET: your client secret from the SfDD
  • SPOTIFY_REDIRECT_URI: http://localhost:8080/
  • SPOTIFY_USER: your spotify username, as written on your Spotify Account page
  • MAIN_PLAYLIST_ID: the playlist id to split; you can find it on the Spotify Web Client in the url: https://open.spotify.com/playlist/<playlist_id>
  1. Curate the sorting algorithm to your liking. Refer to the Audio Features page for more sorting criteria.
  2. Change the Playlist objects' initialization (playlist_name) to your liking.
  3. Run the spotify-splitter.py script.
  4. You may choose to run this on a cron job in order to keep updating your playlists on a regular basis. We run ours daily at midnight.

You will have to authorize your Spotify account on first run.

Enjoy your split music!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages