Play only a single item when playspec has item-spec (Podcasts/Audiobooks)

This commit is contained in:
ejurgensen 2014-03-21 23:38:14 +01:00
parent c01698e462
commit 708b76ce1e
2 changed files with 27 additions and 9 deletions

View File

@ -899,10 +899,9 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
if (!shuffle)
{
/* Start song ID */
param = evhttp_find_header(query, "container-item-spec");
if (!param)
param = evhttp_find_header(query, "item-spec");
if (!param)
if ((param = evhttp_find_header(query, "item-spec")))
plid = 0; // This is a podcast/audiobook - just play a single item, not a playlist
else if (!(param = evhttp_find_header(query, "container-item-spec")))
{
DPRINTF(E_LOG, L_DACP, "No container-item-spec/item-spec in playspec request\n");

View File

@ -849,17 +849,36 @@ player_queue_make_pl(int plid, uint32_t *id)
struct player_source *ps;
struct player_source *p;
uint32_t i;
char buf[124];
memset(&qp, 0, sizeof(struct query_params));
qp.id = plid;
qp.type = Q_PLITEMS;
qp.offset = 0;
qp.limit = 0;
qp.sort = S_NONE;
if (plid)
{
qp.id = plid;
qp.type = Q_PLITEMS;
qp.offset = 0;
qp.limit = 0;
qp.sort = S_NONE;
}
else if (*id)
{
qp.id = 0;
qp.type = Q_ITEMS;
qp.offset = 0;
qp.limit = 0;
qp.sort = S_NONE;
snprintf(buf, sizeof(buf), "f.id = %" PRIu32, *id);
qp.filter = strdup(buf);
}
else
return NULL;
ps = player_queue_make(&qp, NULL);
if (qp.filter)
free(qp.filter);
/* Shortcut for shuffled playlist */
if (*id == 0)
return ps;