Skip to content

Commit

Permalink
Merge pull request #1862 from hacketiwack/master
Browse files Browse the repository at this point in the history
[api] Stop playback once last item is removed from the queue
  • Loading branch information
ejurgensen authored Feb 16, 2025
2 parents 1abc753 + c72dc48 commit 7cde752
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/httpd_jsonapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2623,6 +2623,7 @@ static int
jsonapi_reply_queue_tracks_delete(struct httpd_request *hreq)
{
uint32_t item_id;
uint32_t count;
int ret;

ret = safe_atou32(hreq->path_parts[3], &item_id);
Expand All @@ -2639,6 +2640,13 @@ jsonapi_reply_queue_tracks_delete(struct httpd_request *hreq)
return HTTP_INTERNAL;
}

db_queue_get_count(&count);
if (count == 0)
{
player_playback_stop();
db_queue_clear(0);
}

return HTTP_NOCONTENT;
}

Expand Down

0 comments on commit 7cde752

Please sign in to comment.