mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-13 16:03:23 -05: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 |
|
||||
| --------------- | ----------------------------------------------------------- |
|
||||
| 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. |
|
||||
| end | *(Optional)* See `start` parameter |
|
||||
|
||||
|
@ -2682,7 +2682,11 @@ jsonapi_reply_queue(struct httpd_request *hreq)
|
||||
query_params.sort = S_SHUFFLE_POS;
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user