Creating the player
Now that we have everything we need to authenticate and consume the Spotify Rest API, we are going to create a small terminal client where we can search for an artist, browse his/her albums, and select a track to play in the Spotify client. Note that to use the client, we will have to issue an access token from a premium account and the authentication flow we need to use here is the AUTHENTICATION_CODE
.
We will also need to require from the user of our application the user-modify-playback-state
scope, which will allow us to control playback. With that said, let's get right into it!
First, we need to create a new directory to keep all the client's related files in it, so go ahead and create a directory named musicterminal/client
.
Our client will only have three views. In the first view, we are going to get the user input and search for an artist. When the artist search is complete, we are going to switch to the second view, where a list of albums for the selected artist...