Merge pull request #1862 from hacketiwack/master

[api] Stop playback once last item is removed from the queue
This commit is contained in:
ejurgensen 2025-02-16 16:24:27 +01:00 committed by GitHub
commit 7cde752f20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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