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.84k stars 461 forks source link

Feature Request: Start Spotify Playlist #110

Closed dbs179 closed 8 years ago

dbs179 commented 8 years ago

Jishi

Thank you for the awesome work. I have your project set up on an Pi 2B and working with my Amazon Echo with no problems. It seems that the playlists function only supports Sonos Playlists. I generally use Spotify, so the bulk of my playlists are set up there. I normally don't bother to re-create them in the Sonos Playlists. I was wondering if it would be possible to play Spotify Playlists directly without re-creating them in the Sonos Playlists? If not, I can work around it easily enough, but direct playback of Spotify Playlists would be amazing.

Thanks, Dave

NovaGL commented 8 years ago

Have you thought of adding them to the favorites?

dbs179 commented 8 years ago

I have done both, adding them to favorites as well as adding them to Sonos Playlists. It isn't a huge deal to do either, but my entire family uses spotify with the family plan. My kids have their own accounts that I follow on our main account attached to the Sonos, so new playlists are added frequently. I just have to remember to add them to either favorites or sonos playlists for the API to play them. If possible, it would be one step simpler to be able to play any playlist (but I'm not sure if that is even feasible)

jishi commented 8 years ago

This is something that isn't easily done at the moment, since most interfacing with Spotify requires access to the SMAPI endpoint that also requires authentication. The authentication info is encrypted in the communication between the controller and the Sonos players, and I have yet to figure out the scheme.

The only possible way that I can see today is using favorites. Of course, if added to favorites, it is then possible to copy the relevant data associated with that favorite, and them remove the favorite again. With that data, it is possible to enqueue that specific spotify playlist, but it is a very coarse route to take.

It is possible to create separate authentication tokens for Spotify that would be used by this API only, but it is a bit of work to build that infrastructure in order to retrieve them, and requires interaction with the user in charge (as a one time thing)

dbs179 commented 8 years ago

Jishi,

Thanks for the very through response. I do very much appreciate your work, it is amazing. Thanks again and I'll keep on adding favorites and sonos playlists!!! If it ever becomes possible, that will just be icing on the cake.

Thanks, Dave

julesbike commented 8 years ago

Is there a way to play Spotify radio station

That could be a workaround.

jishi commented 8 years ago

I believe that you can add a spotify playlist now using the uri for that playlist, example:

spotify:user:avflox:playlist:41FyulxoQpuGlvgU7GqUtr