This is a Flask web app that generates a playlist of a user's saved tracks, top tracks, and recommendations based on the user's listening habits and followed artists' releases in a specified month and year/ The app uses the Spotify Web API to retrieve the user's data.
The app has the following features:
- Login with Spotify OAuth 2.0 to authorize access to the user's data.
- Input form for the user to specify the month and year for playlist generation.
- Playlist generation based on saved tracks, top tracks, releases from followed artists, and recommended tracks.
- A review page for users to remove tracks from the generated playlist and specify a custom title, description, and cover image.
- Error handling for Spotify API calls.
The app uses the following technologies:
- Flask, a Python web framework
- Spotipy, a Python library for the Spotify Web API
- HTML, CSS, and JavaScript for the front-end web interface
Make sure you have Python 3 and pip installed on your local machine and have a Spotify Developer account.
- Clone the project repository from Github to your local machine.
- Create a new virtual environment in the project directory using the following command:
$ python3 -m venv venv - Active the virtual environment using the following command:
$ source venv/bin/activate - Install the project dependencies using the following command:
$ pip install -r requirements.txt - Go to the Spotify Developer Dashboard and create a new app.
- Set the Redirect URI to:
http://localhost:3000/redirect - Create a new file called
config.pyin the project directory and add the following code:
CLIENT_ID = 'your-client-id'
CLIENT_SECRET = 'your-client-secret'
SECRET_KEY = 'your-secret-key'
- Replace
your-client-id,your-client-secret, andyour-secret-keywith your own values. You can get your client ID and client secret from the Settings page of your new Spotify app. - Run the following command to start the Flask development server:
flask run - Open http://localhost:3000 to access the web application.