jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.85k stars 460 forks source link

Music search url with spaces #478

Open ghost opened 7 years ago

ghost commented 7 years ago

Some feedback on Music search. When using music search with Deezer I seem to be getting inconsistent results depending on how I format the url string:

The Readme infers we should use + but this only seems to work on some artist/url.

Doesn't work /living%20room/musicsearch/deezer/song/artist:two+door+cinema+club /living%20room/musicsearch/deezer/song/artist:two%20door%20cinema%20club /living%20room/musicsearch/deezer/song/artist:florence%20and%20the%20machine

Works /living%20room/musicsearch/deezer/song/artist:pink floyd /living%20room/musicsearch/deezer/song/artist:pink+floyd /living%20room/musicsearch/deezer/song/artist:pink%20floyd

/living%20room/musicsearch/deezer/song/artist:"two door cinema club"

Cheers!

Great work!

jishi commented 7 years ago

The correct space sequence for a url is %20, you should never use plus because that would actually be a literal + when you search.

We should change the documentation to be correct, but why you wouldn't get result is weird. I'll need to check how we forward the search phrases to Deezer.

jplourde5 commented 7 years ago

I believe e that the '+' came with the Apple API and had also worked with other solutions too. Spaces also seemed to work with Apple, so taking out the '+' may be a good idea if they are problematic for other services.

Keep in mind that a lot of this is passed on the the external service search API, in this case Deezer, so behavior can vary, and the inconsistency here is most likely in the Deezer search API itself.