mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
[dacp] Don't return hard error if queue item goes missing
Remote doesn't seem to like the 500 Internal error we were sending if queue item went missing, e.g. during pause.
This commit is contained in:
parent
c4713d8b39
commit
dbf9a208b8
@ -156,6 +156,16 @@ static struct dacp_update_request *update_requests;
|
||||
static struct event *seek_timer;
|
||||
static int seek_target;
|
||||
|
||||
/* If an item is removed from the library while in the queue, we replace it with this */
|
||||
static struct media_file_info dummy_mfi =
|
||||
{
|
||||
.id = 9999999,
|
||||
.title = "(unknown title)",
|
||||
.artist = "(unknown artist)",
|
||||
.album = "(unknown album)",
|
||||
.genre = "(unknown genre)",
|
||||
};
|
||||
|
||||
|
||||
/* DACP helpers */
|
||||
static void
|
||||
@ -240,7 +250,7 @@ make_playstatusupdate(struct evbuffer *evbuf)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DACP, "Could not fetch file id %d\n", status.id);
|
||||
|
||||
return -1;
|
||||
mfi = &dummy_mfi;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -272,6 +282,7 @@ make_playstatusupdate(struct evbuffer *evbuf)
|
||||
|
||||
dacp_playingtime(psu, &status, mfi);
|
||||
|
||||
if (mfi != &dummy_mfi)
|
||||
free_mfi(mfi, 0);
|
||||
}
|
||||
|
||||
@ -1453,7 +1464,7 @@ playqueuecontents_add_source(struct evbuffer *songlist, uint32_t source_id, int
|
||||
if (!mfi)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DACP, "Could not fetch file id %d\n", source_id);
|
||||
return -1;
|
||||
mfi = &dummy_mfi;
|
||||
}
|
||||
dmap_add_container(song, "ceQs", 16);
|
||||
dmap_add_raw_uint32(song, 1); /* Database */
|
||||
@ -1476,6 +1487,7 @@ playqueuecontents_add_source(struct evbuffer *songlist, uint32_t source_id, int
|
||||
|
||||
ret = evbuffer_add_buffer(songlist, song);
|
||||
evbuffer_free(song);
|
||||
if (mfi != &dummy_mfi)
|
||||
free_mfi(mfi, 0);
|
||||
|
||||
if (ret < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user