If you're like me you don't really have an answer to the question "What type of music do you listen to?". You either play the same few playlists over and over again or just listen to whatever the first thing you happen to put your eyes on.
The goal of this cli program is to broaden your music taste by keeping track of all the music genres you listen to and having a set time goal for each of them.
The Spotify API is meant to be used server side so in order to run it locally a few unusual steps are required. If I see this project take off I might set it up to work on a server and make it publicly available.
- Login to your Spotify account in the developer dashboard.
- Click "Create app".
- Fill in the required information.
Name
anddescription
are irrelevant so write whatever you want here.Website
can be left blank.redirect uri
: This url is used for authentication purposes. Use any localhost url you have. For example, the one used during development ishttp://localhost:8888/callback
.API/SDK
: Only the Web API is required for this project to work.
- Clone this repository.
- In a
.env
file set theclient_secret
key to your app's client id. - Run the program by typing
python main.py
in the command line. - Input 1 to authenticate against the Spotify API.
- After authorizing the app you should be redirected to the
redirect uri
that you set in the app setup. This should show a connection error unless you're running a server on that port. Either way just copy the url and paste it into the program.
Now you should have access to all commands. Start listening to anything on Spotify and the program will keep track of it!
This project uses the Python programming language and the Spotify API. Special thanks to Andytlr for a list of a lot of Spotify genres. Although extensive, it is by no means exhaustive, the program will notify you if any genres not already in the database is found. Please contact me so I can add it into future releases of the program.
The information is stored in a local sqlite database in the ./database
directory. This also includes the refresh token used to
authenticate against the Spotify servers. Although no issues should
arise if this token gets compromised as it only uses read-only
permissions, I'm open to ideas on how to store the token locally
without risk of it being stolen.
This project uses two configuration files: .env
and config.cfg
.
client_secret (.env)
: The client id of your Spotify app.
goal_time (config.cfg)
: The time in hours that should be achieved for every genre (Default=5).