Connects to the Spotify API to retrive the current track and write to disk. The information can then be picked up by a third-party, such as OBS.
- yarn
- node.js
Define environment variables called SPOTIFY_API_ID
& SPOTIFY_API_SECRET
and set it to your Spotify app's client id / secret (get this from the Spotify developer dashboard).
Make sure all of the dependencies are installed using yarn
.
This only needs to be done on first-run or if you're having problems with authentication.
In order to retrieve an access token, we need to handshake with Spotify using our client id and secret.
yarn run start:auth
You will need to add a whitelist address in the Spotify apps settings (default: http://localhost:8081/login) so it can talk back to your machine after logging in.
Finally, in a browser visit the server you're running (default: http://localhost:8081). If everything is setup correctly you'll be asked to confirm your identity with Spotify and the access tokens will be written to disk (default: ./config/local.json)
Run: yarn start
By default, the artist and album name will be written to /tmp/spotify-currently-playing.txt