Websockets playPlaylist Python Script input

Hi everyone,

I am currently building a childproof musicbox for my little son. It is supposed to play given playlists by RFID input (emulated keyboard; the USB-RFID reader returns HEX-code and presses ENTER). I would like to integrate this functionality by running a Python script next to volumio, communicating via the websocket API. The python script prompts for an input from the connected RFID-reader and then hands the playlist name (corresponding to the HEX-code from an RFID-card) to volumio via the API using socketIO and the playPlaylist command.

I began writing some code and was wondering if something like the following could work:

while True : inp = input("Waiting for card...") socketIO.emit('playPlaylist' {"name":"inp"})

I am but a simple hobby programmer and quite new to APIs. Feel free to point out my potentially stupid mistakes. I shall be thankful!

Figured it out, the following works just fine:

while True : inp = input("Waiting for card...") socketIO.emit('playPlaylist' {"name":inp})


I am just trying to to the same. Have the RFID card reader working fine with another distribution but I would like to do the same with Volumio. I managed to send play, volume up etc using an python script and websocket API but no luck with spotify playlist or web radios. Do you know how to do that?