After some playing around and thanks to a key hint from Jackie, I’ve figured out a working example, actually 3:
curl -i -X POST localhost:3000/api/v1/replaceAndPlay --data "service=webradio&type=webradio&title=Nova%20La%20Nuit&uri=http://nova-ln.ice.infomaniak.ch/nova-ln-128&albumart=https://www.nova.fr/sites/default/files/2020-06/Nova%20la%20Nuit_1.jpg"
curl -i -X POST localhost:3000/api/v1/replaceAndPlay --data "service=webradio&type=webradio&title=KCRW%20Eclectic%2024&uri=http://media.kcrw.com/pls/kcrwmusic.pls&albumart=https://www.kcrw.com/music/shows/eclectic24/@@images/image/listing-square"
curl -i -X POST localhost:3000/api/v1/replaceAndPlay --data "service=webradio&type=webradio&title=BBC%20Radio%204&uri=http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p&albumart=https://radio-directory.firebaseapp.com/volumio/src/images/radio-thumbnails/BBC%20Radio%204%20FM.jpg"
What is now the best location to keep these scripted commands (bash scripts)? Only /media folder or could /usr/local/bin et similar be a valid and upgrade proof alternative?
Hi, I created myself a volumio dedicated 20-key keyboard to quickly change the most frequently used settings like volume, pause, and play my favourite radio stations o playlists on the fly, without having to open the smartphone and do the many steps to reach a specific command in the web UI. Sometimes it’s ok to use the web UI, browse the music library, etc. but sometimes its just faster to use a dedicated physical “button”.
So the keyboard has been programmed to type a specific text string for each key in its firmware like “volumio stop” which leverages the terminal volume command line client. Unfortunately this command utility does not support to play radio stations so I had to explore alternatives and this is where I tried to stick to official API (REST API section) documentation and use the curl tool to send http requests via bash scripts that are started by the keyboard macros.
I was able to make this work perfectly fine with the above scripted commands but since the last volume update things have changed and I haven’t yet found an alternative compatible “syntax”.
IIRC there was a change to the API to allow only JSON requests…
So you’ll need to set the proper header (-H) when you make your request.
Something along these lines…