Skip to content
Generates mood based playlists using Spotify listening history
Python HTML JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
static
templates
.gitignore
README.md
model.py
mood.py
requirements.txt
server.py
settings.py
spotify.py
views.py

README.md

Moodify

Moodify is a web application that uses the Spotify API to generate playlists based on a users Spotify listening history and current mood.

Table of Contents

Overview

Once authorized, Moodify gathers and stores a users listening history in a PostgreSQL database along with information for three audio features: danceability, energy, and valence. In order to uniformly segment the data provided by Spotify, Moodify normalizes the audio feature data for each user and an algorithm is applied to the normalized values to create a playlist with tracks specific to the user and their current mood. Once the playlist is created, the users can then view and play their playlist through Spotify as well as Moodify itself.

Tech Stack

Frontend: ReactJS, Javascript, Jinja, jQuery, Bootstrap
Backend: Python, Flask, SQLAlchemy, PostgreSQL
Libraries: Scipy, Numpy
APIs: Spotify

Setup/Installation

Get Client ID and Client Secret from Spotify and save them to a file secrets.sh:

export SPOTIFY_CLIENT_SECRET=YOUR_KEY
export SPOTIFY_CLIENT_ID=YOUR_KEY

On local machine, go to directory where you want to work and clone Moodify repository:

$ git clone https://github.com/mahnoorshafi/Moodify.git

Create a virtual environment in the directory:

$ virtualenv env

Activate virtual environment:

$ source env/bin/activate

Install dependencies:

$ pip install -r requirements.txt

Create database:

$ createdb moodify

Create your database tables:

$ python3 model.py

Source secrets.sh:

$ source secrets.sh

Run the app:

$ python3 server.py

Open localhost:5000 on browser.

Demo

Log in through Spotify and create your playlist by selecting a mood:

Homepage

Once created, play your playlist through Spotify Web Player or through Moodify:

Selecting Mood

View playlist and select song to play as well as skip through songs:

View and Play Playlist

Future Features

  • Fine tune algorithm that selects songs
  • Give user's the ability to view all their past mood playlists
  • Option to preview playlist and then save it
You can’t perform that action at this time.