API command line for start Playing a specific Folder from NAS share?

Volumio Information

Volumio Version: v2.917
Hardware: Raspbery Pi3 B+
DAC: Internal


I have already asked regarding this in this thread, but I guess I may get answers more quickly If I post a new question regarding the API command line part only.

So my question is, how do I specify a command line for Volumio’s API to start playing a specified folder from my NAS (SMB) shares. (The folder is already given to the Music Library->NAS section in Volumio). (So I can add it to my triggerhappy configuration to use it with a remote). Could someone give an example API command line for this? I could not figure it out from the Volumio Wiki’s API description, as it far too complicated.

Thank you!

I overviewed the other threads here in the API section and find some clues, but still just clues, because all the other threads were about webradios. So what if I specify this:

volumio@volumio:~$ curl -i --header “Content-Type: application/json” localhost:3000/api/v1/replaceAndPlay --data '{
“service”: “mpd”,
“type”: “folder”,
“title”: “Remixes”,
“uri”: “mnt/NAS/Music_1/Remixes”,
“albumart”: “/albumart?cacheid=873&web=OLD%20Stuff%20Relatives//extralarge&path=%2FNAS%2FANYU_ZEN%C3%89I_1%2F01%20Orosz%201&metadata=false”

So will this work? Or do I need som other command instead of “curl”? Or I must also add a track title for the “title” and the “uri” section as well? even if it would be the first track in that folder, won’t it just play that simple track and than stop the playback? Because I want to playback the whole folder this way, like when I click on the “Play button” on the left side of the folder’s name in the WEB UI in the Music Library->NAS browser.

you still have to close bracked…>>>> }’
but this is for playing a folder

It does not work. What should I fix here?

For clues - when you select and have this folder playing, look at your <volumio-ip>/dev page and see what the correct uri and path attributes need to be!

This path I have entered is an example. But of course the path I enter is correct. But one thing: I can not enter accented letters while editing the triggerhapy config file trough SSH: “Én Zenéim” would convert to: " ^ n Zen ^ im" when entered in the command list. What to do whit this?

I don’t think this is possible with Volumio. You need to load a queue for playing. This feature was request some time ago.

Are you sure – isn’t there a folder view in one of the menus?
Or does it only let you browse files, and then let you add each track from a folder manually?

There’s a Folder view from Music Library NAS->My Share → here it lists all the folders the main Shared Folder has and I can play the entire folder by clicking the play icon in the left corner of the Folder’s name. As I wrote this is already form the Music Library section, so I have all these Folders and files scanned in already.

yes I know, and it will built a complete queue list for that folder. But I don’t see this function in the API’s.
I can see play an Item (single track) or a list, but that is what you have to pass as parameter

Unfortunately, there isn’t much documentation for these parts.
Your best bet is to open up the log on ssh, click on the UI and see what commands are being called.

i got from rest api :
radio: play station / addtoqueue
playlist: playplaylist
youtube: song / channel / playlist / addtoqueue of all
mixcloud: song / addtoqueue
soundcloud: song / addtoqueue

seek0 / prev / stop / play / next / vol +5 / vol -5

all for streamdeck :stuck_out_tongue:

How to display the log with ssh?

Volumio uses Explode in the background to harvest the folder and make it available to mpd. This function is not available through the API’s.
You can create a bypass, creating a playlist and load that by API, but that is a bit cumber sum to accomplish.

info: CorePlayQueue::clearPlayQueue
info: CorePlayQueue::saveQueue
info: CoreCommandRouter::volumioPushState
info: CoreCommandRouter::volumioPushQueue
info: CoreStateMachine::addQueueItems
info: CorePlayQueue::addQueueItems
info: Adding Item to queue: music-library/NAS/QNAP/Morgan Wade
info: Exploding uri music-library/NAS/QNAP/Morgan Wade in service mpd
---------------------------- MPD announces state update: player
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0101%20-%20Morgan%20Wade%20-%20Wilder%20Days.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0101 - Morgan Wade - Wilder Days.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0102%20-%20Morgan%20Wade%20-%20Matches%20and%20Metaphors.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0102 - Morgan Wade - Matches and Metaphors.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0103%20-%20Morgan%20Wade%20-%20Other%20Side.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0103 - Morgan Wade - Other Side.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0104%20-%20Morgan%20Wade%20-%20Don't%20Cry.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0104 - Morgan Wade - Don't Cry.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0105%20-%20Morgan%20Wade%20-%20Mend.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0105 - Morgan Wade - Mend.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0106%20-%20Morgan%20Wade%20-%20Last%20Cigarette.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0106 - Morgan Wade - Last Cigarette.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0107%20-%20Morgan%20Wade%20-%20Take%20Me%20Away.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0107 - Morgan Wade - Take Me Away.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0108%20-%20Morgan%20Wade%20-%20Reckless.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0108 - Morgan Wade - Reckless.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0109%20-%20Morgan%20Wade%20-%20Northern%20Air.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0109 - Morgan Wade - Northern Air.flac
info: ALBUMART /albumart?cacheid=487&web=Morgan%20Wade/Reckless/mega&path=%2Fmnt%2FNAS%2FQNAP%2FMorgan%20Wade%2F(2021)%20-%20Reckless%2F0110%20-%20Morgan%20Wade%20-%20Met%20You.flac&metadata=false
info: URI /mnt/NAS/QNAP/Morgan Wade/(2021) - Reckless/0110 - Morgan Wade - Met You.flac

you could create it as a Queue playlist and save it as playlist and call the playlist with a curl

and for your remote u could try this :

Seems possible, to add the complete folder.
I believe there was a plugin tpo play the last played song, so if you set the list to random, you might even not to program anything.

I have added the folders as Playlists and it works through browser:

But not with SSH (so locally from the triggerhapy file):
curl localhost:3000/api/v1/commands/?cmd=playplaylist&name=Remixes

So what’s the trick here?


 curl "localhost:3000/api/v1/commands/?cmd=playplaylist&name=Remixes"

Yes at the end I have figured out the missing quote sings. Finally it works this way! Thank you everyone have tried to solve this…

Oh one more thing: I also want to do this with a couple of webradio station. Now how to do the same with webradios?