Giter VIP home page Giter VIP logo

spotify-splitter's Introduction

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!

spotify-splitter's People

Contributors

gusvieweg avatar addiejackson avatar

Stargazers

Morgan Howell avatar Joshua Potter avatar

Watchers

James Cloos avatar  avatar

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.