Merge pull request #645 from whatdoineed2do/queue-add-item-count-fix

[jsonapi] correct count of tracks added returned
This commit is contained in:
chme 2018-12-28 19:54:55 +01:00 committed by GitHub
commit d9f00a3ab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);