Spotify vMix Integration

The quickstart: https://developer.spotify.com/documentation/web-api/quick-start/

Create the App: https://developer.spotify.com/documentation/general/guides/app-settings/#register-your-app

Our apps: https://www.spotify.com/us/account/apps/

Well that codebase is outdated, but it was a good intro. Also tested some Curl requests, which you can generate via their console.

I think that this Python library, Spotipy will be our tool of choice. It’s open source on GitHub.

Here’s our endpoint reference: https://developer.spotify.com/documentation/web-api/reference/

Aadd our App Authorization creds to the (newly created vENV) environment into which we have installed Spotipy:

export SPOTIPY_CLIENT_ID='your-spotify-client-id'
export SPOTIPY_CLIENT_SECRET='your-spotify-client-secret'
export SPOTIPY_REDIRECT_URI='your-app-redirect-url'

Now let’s try running a demo script:

{
"collaborative": false,
"description": "Your daily update of the most played tracks in Germany right now.",
"external_urls": {
"spotify": "https://open.spotify.com/playlist/37i9dQZEVXbJiZcmkrIHGU"
},
# etc…
"type": "playlist",
"uri": "spotify:playlist:37i9dQZEVXbJiZcmkrIHGU"
}

vMix will dynamically read from TXT, CSV, RSS, XML, Google Sheets files. What we want vMix to display is details about the current song like image, current cue location, total time, time left, etc…

To test continuously updating a file, I came up with:

import itertools
for i in itertools.count(start=0, step=1):
    f = open('info.txt', 'w')
    f.write(str(i))
    f.close()

Which doesn’t work because it leaves the output file (‘info.txt’) in frequent states of instability. Someone on Stack Overflow suggested this:

import os
import shutil
import itertools
for i in itertools.count(start=0, step=1):
    f = open('tmp', 'w')
    f.write(str(i))
    f.close()
    shutil.move('tmp', 'info.txt')

My guess is that this isn’t the approach we will ultimately use. Next thing I really need to do it develop a simple roadmap.