Skip to content

Quick script that creates a Spotify playlist made from songs already in your other playlists, given some user condition (e.g. a desired BPM range)

Notifications You must be signed in to change notification settings

callistachang/songs-for-jogging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

songs-for-jogging

Quick script that creates a Spotify playlist made from songs already in your other playlists, given some user condition (e.g. a desired BPM range)

Usage

Get your Spotify client ID and client secret and your Spotify user id, create a new file .env based on .env.example and fill in values

Motivation

I wanted a playlist of songs for jogging in the range of 82-85 BPM made of songs I already knew, i.e. songs I've included in other playlists I've made before. So here's an impulse script written at 5am by a very delirious and jetlagged individual, but it works! (hopefully)

TIL Spotify exposes every song's audio features via API, so for example one could set a threshold for how energetic they want their jogging playlist to be. The sky's the limit - you could make a playlist of just instrumental songs, or songs in the key of C, whatever tickles ur fancy

Examples

client.create_playlist(playlist_name="running-songs", condition=lambda f: (82 < f["tempo"] < 85 or 164 < f["tempo"] < 170) and f["energy"] > 0.5)
client.create_playlist(playlist_name="apparently-danceable", condition=lambda features: features["danceability"] > 0.9)
client.create_playlist(playlist_name="in-the-key-of-c", condition=lambda features: features["key"] == 0)
client.create_playlist(playlist_name="minor-songs", condition=lambda features: features["mode"] == 0)

Future Work

CLI interface and definitely cleanup

About

Quick script that creates a Spotify playlist made from songs already in your other playlists, given some user condition (e.g. a desired BPM range)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages