File tree 2 files changed +20
-6
lines changed
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:
140
140
Queue
141
141
-----
142
142
Obtain 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)
144
146
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
146
152
147
153
Example queue response:
148
154
```
149
155
[
150
156
{
151
- "uri": "x-sonos-spotify:spotify%3atrack%3a0AvV49z4EPz5ocYN7eKGAK?sid=9&flags=8224&sn=3",
152
157
"albumArtURI": "/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a0AvV49z4EPz5ocYN7eKGAK%3fsid%3d9%26flags%3d8224%26sn%3d3",
153
158
"title": "No Diggity",
154
159
"artist": "Blackstreet",
155
160
"album": "Another Level"
156
161
},
157
162
{
158
- "uri": "x-sonos-spotify:spotify%3atrack%3a5OQGeJ1ceykovrykZsGhqL?sid=9&flags=8224&sn=3",
159
163
"albumArtURI": "/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a5OQGeJ1ceykovrykZsGhqL%3fsid%3d9%26flags%3d8224%26sn%3d3",
160
164
"title": "Breathless",
161
165
"artist": "The Corrs",
Original file line number Diff line number Diff line change @@ -13,9 +13,19 @@ function simplify(items) {
13
13
}
14
14
15
15
function queue ( player , values ) {
16
- const detailed = values [ 0 ] === 'detailed' ;
16
+ const detailed = values [ values . length - 1 ] === 'detailed' ;
17
+ let limit ;
18
+ let offset ;
17
19
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 ) ;
19
29
20
30
if ( detailed ) {
21
31
return promise ;
You can’t perform that action at this time.
0 commit comments