HI there, can anyone help me out with this?
I am trying to play MP3 files upon a http request, but want it to be dynamic.
So if i can change the name of the file in the request and the flow can handle it.
So far i have this flow what can play a certain file on my reaspberry.
This is playing the morning.mp3 file on my Google nest speaker.
[{"id":"1ef09eb0.9f81e1","type":"cast-to-client","z":"296735b2.aac42a","name":"","url":"","contentType":"","message":"","language":"en","ip":"","port":"","volume":"","x":1190,"y":220,"wires":[[]]},{"id":"8eb13b72.be6608","type":"http in","z":"296735b2.aac42a","name":"","url":"/home/pi/Music/morning","method":"get","upload":false,"swaggerDoc":"","x":580,"y":360,"wires":[["6d7a0ffb.0a4a3","fb8c1056.da028"]]},{"id":"6d7a0ffb.0a4a3","type":"file in","z":"296735b2.aac42a","name":"","filename":"/home/pi/Music/morning.mp3","format":"","chunk":false,"sendError":false,"encoding":"none","x":920,"y":360,"wires":[["bd9cb0bc.f24ee","75344466.d45b2c"]]},{"id":"bd9cb0bc.f24ee","type":"http response","z":"296735b2.aac42a","name":"","statusCode":"","headers":{"contentType":"audio/mp3"},"x":1230,"y":360,"wires":[]},{"id":"fb8c1056.da028","type":"debug","z":"296735b2.aac42a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":420,"wires":[]},{"id":"75344466.d45b2c","type":"debug","z":"296735b2.aac42a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1250,"y":420,"wires":[]},{"id":"306dc77e.7b3a48","type":"change","z":"296735b2.aac42a","name":"","rules":[{"t":"set","p":"ip","pt":"msg","to":"192.168.100.222","tot":"str"},{"t":"set","p":"url","pt":"msg","to":"http://192.168.100.131:1880/home/pi/Music/morning","tot":"str"},{"t":"set","p":"contentType","pt":"msg","to":"audio/mp3","tot":"str"},{"t":"set","p":"volume","pt":"msg","to":"40","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":220,"wires":[["1ef09eb0.9f81e1"]]},{"id":"5157a428.cab37c","type":"http in","z":"296735b2.aac42a","name":"","url":"/playnest","method":"post","upload":false,"swaggerDoc":"","x":540,"y":220,"wires":[["306dc77e.7b3a48","9b0981f4.cc9ad","d12c9237.14793"]]},{"id":"9b0981f4.cc9ad","type":"http response","z":"296735b2.aac42a","name":"","statusCode":"200","headers":{},"x":540,"y":280,"wires":[]},{"id":"d12c9237.14793","type":"debug","z":"296735b2.aac42a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":280,"wires":[]}]
As you see the POST request contains the data about the file to be played.
However, my goal is to get this filename from the POST to the GET request dynamically, so i can use this flow for playing any mp3 sitting in the same direcotry.
Example..If i make the POST call which contains in his data this URL
http://192.168.100.131:1880/home/pi/Music/evening
then the GET call will find this file according to the URL and buffer it through the file node.
so itt will play the /home/pi/Music/evening.mp3 file through the CAST node.
If I want to play e.g. the http://192.168.100.131:1880/home/pi/Music/mornig.mp3 then I just need
to store the "Morning" name in my POST data, and it will be played on google nest.
I hope i could explain my goal, and someone will find a solution.
Big help in advance.