Action depending on the playlist

Volumio Information

Volumio Version: volumio-2.853-2020-11-20-pi.img
Hardware: Raspberry Pi 3 Model B Rev 1.2

Hello,

I try to write a bash script: if playlist xyz is running, play the next song (webradio), if playlist xyz NOT playing, do nothing. But how can I see the aktive playlist? With “volumio status” I can’t see the playlist:

root@volumio:/data# volumio status -v
{
  "status": "play",
  "position": 0,
  "title": "QUEEN - THANK GOD IT'S CHRISTMAS",
  "artist": "HITRADIO RTL 90er",
  "album": null,
  "albumart": "http://cdn-radiotime-logos.tunein.com/s0q.png",
  "uri": "https://streams.bcs-systems.de/hrrtl/90er/sachsen/mp3/tunein",
  "trackType": "webradio",
  "seek": 1586716,
  "duration": 0,
  "samplerate": "",
  "bitdepth": "",
  "channels": 2,
  "bitrate": "192 Kbps",
  "random": true,
  "repeat": null,
  "repeatSingle": false,
  "consume": true,
  "volume": 50,
  "mute": false,
  "disableVolumeControl": false,
  "stream": true,
  "updatedb": false,
  "volatile": false,
  "service": "webradio"
}
root@volumio:/data#

Any ideas?

Edit:

volumio@volumio:~$ mpc playlist
HITRADIO RTL 90er: KAMI & PURPLE SCHULZ - ICH WILL RAUS(SEHNSUCHT)
volumio@volumio:~$

But I should get “RadioMix”, the name of the Playlist from the WebUI. Hmm…

To have a better documentation, I have found a way to read the Playlist:

root@volumio:~# curl volumio.local:3000/api/v1/listplaylists
["RadioMix"]root@volumio:~#

But there is no docu about loading this/a playlist?

OK, this:

curl "volumio.local:3000/api/v1/commands/?cmd=playplaylist&name=RadioMix"

works.

OK, now everything works. The first row, ask, which radio transmitter are in the queue. If there are not the transmitter from the playlist “RadioMix”, the playlist “RadioMix” is loading:

playlist=`curl --silent volumio.local:3000/api/v1/getQueue | grep -E 'HITRADIO RTL - Dresden.*Fritz.*ANTENNE.*MDR.*ENERGY'`
[[ ! -z "$playlist" ]] && true || curl "volumio.local:3000/api/v1/commands/?cmd=playplaylist&name=RadioMix"

Volumio is really great, thank you :grin: