node-sonos-http-api icon indicating copy to clipboard operation
node-sonos-http-api copied to clipboard

How to play clip from path

Open mediendiver opened this issue 3 years ago • 1 comments
trafficstars

I would like to play a file in path like this: /test/1.mp3, but it doesn't work. If I copy the file in /1.mp3 it works fine. But when I copy the file in the folder test, it doesn't work.

This work for me: http://127.0.0.1:5005/Bad/clip/1.mp3 So, the file ist playing, but I get an error, that the file is not found.

This works not: http://127.0.0.1:5005/Bad/clip/test/1.mp3 or http://127.0.0.1:5005/Bad/clip%2f1.mp3

How can I fixed it?

mediendiver avatar Jan 25 '22 10:01 mediendiver

You can't right now. Because the API is actually using / as a delimiter for multiple parameters, it gets confused by this.

https://github.com/jishi/node-sonos-http-api/blob/master/lib/actions/clip.js#L14

values[0] will become test in your example, and 1.mp3 will be interpreted as volume. It is also not decoding parameters (only the room name) so your url escaping doesn't work.

That could easily be fixed though, by adding a decodeURIComponent on line 14. Then you would be able to do

http://127.0.0.1:5005/Bad/clip/test%2f1.mp3

I think.

jishi avatar Feb 25 '22 16:02 jishi