jishi / node-sonos-web-controller

A web based controller for Sonos utilizing web sockets for a native look and feel
MIT License
248 stars 45 forks source link

queue #62

Closed JohanSpijker closed 7 years ago

JohanSpijker commented 7 years ago

Hello, I like your http to sonos node very much ! But how do you use the queue function. It returns always the complete queue list. I hoped I was getting only the first 3 songs back when I send this command: http://192.168.1.22:5005/zone1/queue/0/3

second question: i there way to receive the info back in xml format instead of json format ?

Johan

jishi commented 7 years ago

I recently changed it to always return everything, because I felt that was a simplification for anyone implementing it. You can make a custom queue function that does pagination, if you like, and use the paginated underlying functions for it, but I don't think it would benefit anyone else.

I have settled for JSON format because it's much more common interchange format today, and less verbose. The actual players do send XML, so if that's easier for you, you can actually just request it from the players directly. You coul duse my API to find out the actual IP of a player though, since that is stateful information.

JohanSpijker commented 7 years ago

Hi Jimmy, Javascript is really nothing for me ☹ But your pi image is helping me a lot ! Can you help what the http command would be to get the state back in xml format ? Johan

Van: Jimmy Shimizu [mailto:notifications@github.com] Verzonden: maandag 23 januari 2017 15:42 Aan: jishi/node-sonos-web-controller CC: Johan Missault Deltavox Projects; Author Onderwerp: Re: [jishi/node-sonos-web-controller] queue (#62)

I recently changed it to always return everything, because I felt that was a simplification for anyone implementing it. You can make a custom queue function that does pagination, if you like, and use the paginated underlying functions for it, but I don't think it would benefit anyone else.

I have settled for JSON format because it's much more common interchange format today, and less verbose. The actual players do send XML, so if that's easier for you, you can actually just request it from the players directly. You coul duse my API to find out the actual IP of a player though, since that is stateful information.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jishi/node-sonos-web-controller/issues/62#issuecomment-274505115, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APd_Tyny1ZTbAkdvNN8mAO3ULBhJrfAWks5rVLxEgaJpZM4LqdH0.

jishi commented 7 years ago

Well, basically, to get the Queue, you invoke the following HTTP request (against the player IP, on port 1400), with the following content:

https://gist.github.com/jishi/00a78c878e0a4ac412384071abb19573

But, replacing the FV:2 (that's for favorites) with Q:0 (the current queue)