[dacp] Add support for non-library artwork, e.g. from Spotify searches

Fixes #1936
This commit is contained in:
ejurgensen 2025-10-25 23:08:46 +02:00
parent 921d4446d6
commit 6f45f8b4a5

View File

@ -164,7 +164,7 @@ dacp_nowplaying(struct evbuffer *evbuf, struct player_status *status, struct db_
* FIXME: Giving the client invalid ids on purpose is hardly ideal, but the
* clients don't seem to use these ids for anything other than rating.
*/
if (queue_item->data_kind == DATA_KIND_HTTP || queue_item->data_kind == DATA_KIND_PIPE)
if (queue_item->data_kind == DATA_KIND_HTTP || queue_item->data_kind == DATA_KIND_PIPE || queue_item->file_id == DB_MEDIA_FILE_NON_PERSISTENT_ID)
{
// Could also use queue_item->queue_version, but it changes a bit too much
// leading to Remote reloading too much
@ -2257,11 +2257,11 @@ dacp_reply_playstatusupdate(struct httpd_request *hreq)
static int
dacp_reply_nowplayingartwork(struct httpd_request *hreq)
{
struct player_status status;
char clen[32];
const char *param;
char *ctype;
size_t len;
uint32_t id;
int max_w;
int max_h;
int ret;
@ -2298,11 +2298,11 @@ dacp_reply_nowplayingartwork(struct httpd_request *hreq)
goto error;
}
ret = player_playing_now(&id);
if (ret < 0)
player_get_status(&status);
if (status.status == PLAY_STOPPED)
goto no_artwork;
ret = artwork_get_item(hreq->out_body, id, max_w, max_h, 0);
ret = artwork_get_by_queue_item_id(hreq->out_body, status.item_id, max_w, max_h, 0);
len = evbuffer_get_length(hreq->out_body);
switch (ret)