File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -140,22 +140,26 @@ Example of a state json:
140140Queue
141141-----
142142Obtain the current queue list from a specified player. The request will accept:
143- - No parameters
143+ - limit (optional)
144+ - offset (optional, requires limit)
145+ - detailed flag (optional, include uri in response)
144146
145- `http://localhost:5005/living room/queue`
147+ http://localhost:5005/living room/queue
148+ http://localhost:5005/living room/queue/10 (only return top 10)
149+ http://localhost:5005/living room/queue/10/10 (return result 11-20)
150+ http://localhost:5005/living room/queue/detailed
151+ http://localhost:5005/living room/queue/10/detailed
146152
147153Example queue response:
148154```
149155[
150156 {
151- "uri": "x-sonos-spotify:spotify%3atrack%3a0AvV49z4EPz5ocYN7eKGAK?sid=9&flags=8224&sn=3",
152157 "albumArtURI": "/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a0AvV49z4EPz5ocYN7eKGAK%3fsid%3d9%26flags%3d8224%26sn%3d3",
153158 "title": "No Diggity",
154159 "artist": "Blackstreet",
155160 "album": "Another Level"
156161 },
157162 {
158- "uri": "x-sonos-spotify:spotify%3atrack%3a5OQGeJ1ceykovrykZsGhqL?sid=9&flags=8224&sn=3",
159163 "albumArtURI": "/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a5OQGeJ1ceykovrykZsGhqL%3fsid%3d9%26flags%3d8224%26sn%3d3",
160164 "title": "Breathless",
161165 "artist": "The Corrs",
Original file line number Diff line number Diff line change @@ -13,9 +13,19 @@ function simplify(items) {
1313}
1414
1515function queue ( player , values ) {
16- const detailed = values [ 0 ] === 'detailed' ;
16+ const detailed = values [ values . length - 1 ] === 'detailed' ;
17+ let limit ;
18+ let offset ;
1719
18- const promise = player . coordinator . getQueue ( ) ;
20+ if ( / \d + / . test ( values [ 0 ] ) ) {
21+ limit = parseInt ( values [ 0 ] ) ;
22+ }
23+
24+ if ( / \d + / . test ( values [ 1 ] ) ) {
25+ offset = parseInt ( values [ 1 ] ) ;
26+ }
27+
28+ const promise = player . coordinator . getQueue ( limit , offset ) ;
1929
2030 if ( detailed ) {
2131 return promise ;
You can’t perform that action at this time.
0 commit comments