python SocketIO add to queue or playlist

I am trying to add a song to the queue and a playlist, through python with socketio, but just don’t seem to get it working.
Simple messages (like play and pause and next; without json) do work, so the fault could be in my syntax.

Some of the things I’ve tried:

uri = "/mnt/INTERNAL/verhalenmachine_2018-02-08_18:50:04.wav"
self._client.emit('addToQueue', {'uri':uri})
self._client.emit('addToPlaylist', {'name': playlist_name, 'service': service, 'uri': uri})

Any hints would be greatly appreciated!

Hi erwinelling,

try removing the slash in front of the path (“mnt/…” instead of “/mnt/…”).
If I am not mistaken, the uri Volumio is expecting is not a linux path, mnt is not the folder in the root filesystem so you don’t want to put a slash in front of it. Doing so will render your uri invalid and Volumio won’t find the file, thus not adding it to the play queue.

Let me know if that works!

PS. If you are going to be interfacing with the socket.io API you might benefit from testing the API with a tool like this one http://amritb.github.io/socketio-client-tool/, so as to isolate yourself from the language you are writing in.

Best,
Cris

Great Cris. Thanks so much. Will try it out and report back! Also many thanks for the socketio tool.

No problem!! Was that it? :smiley:

Yes! That was part of the problem. A very hard bug to squash :slight_smile: Thanks so much. Everything is working now.

(Also testing many websocket calls in a row, to see if anything worked, seemed Volumio to get nauseous and restart.)

Hi, I am trying to ‘browseLibrary’ for a random track uri to send to the queue.
I can manage this for a complete album but the ‘browseLibrary’ parameters for a uri search are eluding me!

Did you ever manage this? If so any pointers in the right direction would be gratefully received.