mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-16 09:08:04 -04:00
[jsonapi] Get currently playing queue item details (closes #1206)
Add now_playing shorthand, so that /api/queue?id=now_playing returns the currently playing queue item info.
This commit is contained in:
parent
1fafab12e3
commit
f77161b5c2
@ -548,7 +548,7 @@ GET /api/queue
|
|||||||
|
|
||||||
| Parameter | Value |
|
| Parameter | Value |
|
||||||
| --------------- | ----------------------------------------------------------- |
|
| --------------- | ----------------------------------------------------------- |
|
||||||
| id | *(Optional)* If a queue item id is given, only the item with the id will be returend. |
|
| id | *(Optional)* If a queue item id is given, only the item with the id will be returend. Use id=now_playing to get the currently playing item. |
|
||||||
| start | *(Optional)* If a `start`and an `end` position is given, only the items from `start` (included) to `end` (excluded) will be returned. If only a `start` position is given, only the item at this position will be returned. |
|
| start | *(Optional)* If a `start`and an `end` position is given, only the items from `start` (included) to `end` (excluded) will be returned. If only a `start` position is given, only the item at this position will be returned. |
|
||||||
| end | *(Optional)* See `start` parameter |
|
| end | *(Optional)* See `start` parameter |
|
||||||
|
|
||||||
|
@ -2682,7 +2682,11 @@ jsonapi_reply_queue(struct httpd_request *hreq)
|
|||||||
query_params.sort = S_SHUFFLE_POS;
|
query_params.sort = S_SHUFFLE_POS;
|
||||||
|
|
||||||
param = evhttp_find_header(hreq->query, "id");
|
param = evhttp_find_header(hreq->query, "id");
|
||||||
if (param && safe_atou32(param, &item_id) == 0)
|
if (param && strcmp(param, "now_playing") == 0)
|
||||||
|
{
|
||||||
|
query_params.filter = db_mprintf("id = %d", status.item_id);
|
||||||
|
}
|
||||||
|
else if (param && safe_atou32(param, &item_id) == 0)
|
||||||
{
|
{
|
||||||
query_params.filter = db_mprintf("id = %d", item_id);
|
query_params.filter = db_mprintf("id = %d", item_id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user