Hi there, with a significant amount of delay:
I can confirm there is a way of telling volumio to play a spotify playlist via the command-line.
I’ll post it here for the desparate users coming here in hope of finding a solution - like me, before I successfully “hacked” into the details of the API.
I’m currently on volumio 2.915 using the “Spotify 2.0.2” plugin.
The whole stuff -as mentioned elsewhere- requires a Spotify premium account.
In a nutshell, what does the trick is to use
- volumio’s REST API, namingly the “replaceAndPlay” call
- a request BODY that has the correct Spotify playlist URI in it
- having a working version of
CURL
(should be pre-installed if you’re using a linux flavour)
In order for the whole shebang to work, you’ll need to know the playlist URI.
That’s a bit cumbersome but actually not too hard.
Open a webbrowser and put in the following URL in the address box:
http://YOUR-VOLUMIO-IP/api/v1/browse?uri=spotify/playlists
…and of course, replace YOUR-VOLUMIO-IP
with the IP address of your volumio player device.
If all works well, you’ll receive a bunch of “json-formatted text”.
Inside that curly-bracked-colon mess, you’ll probably be able to spot something similar to
,"type":"playlist","title":"XXXYYYZZZ",
where XXXYYYZZ stands for a playlist name of one of your Spotify playlists.
Now, not too far away from this, there will also be a text looking like
"uri":"spotify:user:spotify:playlist:xxxxxxxxxxxxxxxxxxxxx"}
…with “xxxxxxx” being a sequence of characters like “5XyZA4EFghZT54dKGt” or similar.
THAT part (starting with the “spotify:user…” up to the closing quotes) is the playlist URI we will need
to use later. Copy-paste it somwhere.
Next, we’ll be crafting a curl command to send to volumio.
I’ll first give an example of how the whole command-line needs to look like:
curl -i --header "Content-Type: application/json" --data '{ "service": "spop","type": "playlist", "title": "PLAYLISTNAME","uri": "spotify:user:spotify:playlist:XXXXXXXXXXXX"}' http://YOUR-VOLUMIO-IP/api/v1/replaceAndPlay
You’ll have to replace
-
PLAYLISTNAME
…with the title
of the playlist (the part where I said “XXXYYYZZZ” above)
-
spotify:user:spotify:playlist:XXXXXXXXXXXX
…with the URI thing, the part I told you to copy-paste above
-
YOUR-VOLUMIO-IP
…with the IP address of your volumio player, just like you did in the webbrowser’s address bar above
Once your command is ready, hit ENTER and keep fingers crossed.
If something goes wrong, check that
- curl is installed
- no quote, bracket or colon is missing from the text replacement action
- the IP of your volumio player is correct and “ping”-able
- the URI was copy-pasted entirely (no characters missing)
Hope this helps.
Cheers, Thomas