This program will retrieve user selected spotify playlists
and run clustering analysis on all contained songs.
The program will create 5 new playlists in the users
Spotify library according to their cluster assignment
based on the k-means algorithm in SKlearn.
This program relies on the following python libraries:
json
flask
requests
urllib.parse
pandas
flask_wtf
wtforms
sklearn
Sign up for a spotify developer account, and create a client ID at https://developer.spotify.com/dashboard/applications
Clone this repository, and create a file 'config.json' in the main application folder containing your spotify client id and secret developer key.
{
"spotify":{
"cid":"XYZ123",
"secret":"XYZ123"
}
}
Change directory to the main folder and run python app.py.
Navigate to localhost:8000 in a browser to start the process.
Sign in to spotify and grant the application permission to read and write to public/private playlists.
Select playlists containing songs you want to analyze, hit the submit button at the bottom of the page.
You will be redirected to a new page with a visualization of the cluster center locations via a radar chart.
The 5 new playlists will be created automatically in your spotify account, named by the most prevalent genre in the included songs. Additional information about each playlist can be found in the comments field.
[Flask](http://flask.palletsprojects.com/en/1.1.x/) - The web framework used
https://github.com/drshrey/spotify-flask-auth-example
https://github.com/ahipolito94/Spotify-Analysis