Music This Week is a music discovery service that generates a Spotify playlist of bands that are playing near you in the near future.
Django web app: Site is called music_this_week, and the app is called music_this_week_app.
eventFinder.py: Crawls the internet to return a list of upcoming events in the specified city.
playlistCreator.py: Creates a spotify playlist based on a list of artists.
In early development. Basic working prototype exists. Does not work for generic users.
This is a personal hobby project, not intended for public use.
Nick Speal 2016. All rights reserved.
Create a virtual environment for your project.
To keep your pip installation clean, we recommend using virtualenvwrapper.
$ mkvirtualenv mtw
Anytime you want to run this project, run:
$ workon mtw
Install dependencies in your virtualenv from the root of the repo.
$ pip install -r requirements.txt
Also install Redis:
$ brew install redis
Create a config file called spotipyCreds.sh under a (gitignored) directory under the root called '_private':
$ echo "
export SPOTIPY_CLIENT_ID='Create a new app at developer.spotify.com to get this'
export SPOTIPY_CLIENT_SECRET='Create a new app at developer.spotify.com to get this'
export SPOTIPY_REDIRECT_URI='http://localhost:8888/callback'
export DJANGO_SECRET_KEY='make one up'
export EVENTFUL_KEY='Request an application key from https://api.eventful.com/keys'
" > _private/spotipyCreds.sh
cd into the root of the repo
Start the redis server: redis-server
In a new terminal window, open the project's virtualenv: workon mtw
Load the private environment variables: source _private/spotipyCreds.sh
Run the appropriate workers: python manage.py runworker search song events
In a new terminal window, open the project's virtualenv: workon mtw
Run the backend: sh run.sh
(Prereq: Make sure you already ran the setup instructions at some previous point.)
In a new terminal window, cd into the musicthisweek-client directory with the frontend application and then run it, (probably npm start
);
Open the frontend application in the browser and follow the instructions
playlistCreator.init_login()
is called with credentials stored in environment vars.its get_authorize_url()
method, which returns a URL we can redirect the browser to in order to go through Spotify's login flow.&show_dialog=True
to the Authorization endpoint(Not supported by Spotipy).For CLI Login:
spotifyHander.PlaylistCreator.cli_login()
for a UI-free loginutil.prompt_for_user_token()
with a username
argument. Spotipy searches for a cached token file in the root directory called .cache-username
util.prompt_for_user_token()
always calls oauth2.SpotifyOAuth
with the optional cache_path
argument, so the cache file is always created if it didn't exist.