Click on any of the following:
This code updates playlists in Spotify based on upcoming music found in your local area. The data source is Bands In Town. It should capture most bands, but maybe not all. If there is ambiguity over a band name for instance, it may mistakenly put the wrong band in the playlist -- sorry about that.
It should be rare and so the overwhelming majority are bands playing LIVE near you soon.
Enjoy =)
Clone the repository:
git clone https://github.com/bgriffen/gigpy.git
Change directory into the cloned repository:
cd gigpy
pip install -r requirements.txt
Also set these environment variables in your ~/.bashrc
or whichever you're using. You can get these from Spotify but you also need to click "Edit Settings" for your app and add the redirect uri below:
export SPOTIFY_CLIENT_ID='SPOTIPY_CLIENT_ID'
export SPOTIFY_CLIENT_SECRET='SPOTIPY_CLIENT_SECRET'
export SPOTIFY_REDIRECT_URI='http://localhost:8899/callback'
export SPOTIFY_CLIENT_PLAYLISTID='SPOTIFY_CLIENT_PLAYLISTID'
export SPOTIFY_USER_ID='SPOTIFY_USER_ID'
You then need to ensure your cities are in the cities.yaml
file. You can obtain the city ID by going to bandsintown.com and checking the URL for the the city_id=2158177
tag.
# cities.yaml
cities:
- name: Brisbane
id: 2174003 # get ID from bandsintown.com URL
playlist: "3PjTtXAvsLe3C59Uabcd" # change to your own spotify playlist
Then you can run:
import gigpy
gigpy.generate_playlists_for_city("Brisbane")
When you first run, you will be asked to login to provide the scope. Once you login, your program will progress.
Tested on Mac OS X 13.2.1 Ventura with Python 3.8. This should work on other platforms, however.
This project is licensed under the MIT License. See LICENSE for details.