This project retrieves tonality data from Spotify's current playback.
To build this project, please follow these steps:
git clone https://github.com/pasquale90/spotify-track-tonality.git
mkdir build
cd build
cmake ..
make
Alternatively you may use Docker to build and run the application:
docker build -t spotify-track-tonality:v1 .
docker run -it <image_id> /bin/bash
Upon successful compilation, two executables are generated:
authenticateUser: Facilitates user authentication with Spotify.getCurrentTone: Retrieves the tonality of the current playback.
-
Follow the instructions to create a
Spotify Developer Applicationusing the Spotify's dashboard. -
Configure credentials, by editing the spotify/credentials.json file, replacing the placeholders for
client_id,client_secret, andredirect_uri.
{
"client_id": "...",
"client_secret": "...",
"redirect_uri": "..."
}
{
"redirect_uri_example": "http://localhost/8080/callback"
}
- Run
./authenticateUserto authenticate your account with the Spotify API. During the first run, you will need to accept the access request, and paste the URL you've been redirected to into the command prompt, to complete the verification process. Upon successful verification, arefresh_tokenfield will be added to the spotify/credentials.json file.
{
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"redirect_uri": "your_redirect_uri",
"refresh_token": "your_refresh_token"
}
- Run
./getCurrentToneeach time you want to retrieve the tonality of the current playing track.
Please note, this repository selectively adapts elements the foundational work of smaltby/spotify-api-plusplus.
-
Implement bug prevention when ads are playing.
-
[] Add KMS features