mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
Merge pull request #645 from whatdoineed2do/queue-add-item-count-fix
[jsonapi] correct count of tracks added returned
This commit is contained in:
commit
d9f00a3ab6
@ -1745,6 +1745,7 @@ jsonapi_reply_queue_tracks_add(struct httpd_request *hreq)
|
|||||||
const char *id;
|
const char *id;
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int ttl_count = 0;
|
||||||
json_object *reply;
|
json_object *reply;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -1810,6 +1811,8 @@ jsonapi_reply_queue_tracks_add(struct httpd_request *hreq)
|
|||||||
|
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
pos += count;
|
pos += count;
|
||||||
|
|
||||||
|
ttl_count += count;
|
||||||
}
|
}
|
||||||
while ((uri = strtok(NULL, ",")));
|
while ((uri = strtok(NULL, ",")));
|
||||||
|
|
||||||
@ -1818,7 +1821,7 @@ jsonapi_reply_queue_tracks_add(struct httpd_request *hreq)
|
|||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
reply = json_object_new_object();
|
reply = json_object_new_object();
|
||||||
json_object_object_add(reply, "count", json_object_new_int(count));
|
json_object_object_add(reply, "count", json_object_new_int(ttl_count));
|
||||||
|
|
||||||
ret = evbuffer_add_printf(hreq->reply, "%s", json_object_to_json_string(reply));
|
ret = evbuffer_add_printf(hreq->reply, "%s", json_object_to_json_string(reply));
|
||||||
jparse_free(reply);
|
jparse_free(reply);
|
||||||
|
Loading…
Reference in New Issue
Block a user