mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
Add support for shuffle in DACP playspec request
This commit is contained in:
parent
fa0ee0553a
commit
94b4cd2459
@ -819,6 +819,7 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
|
||||
struct player_source *ps;
|
||||
struct daap_session *s;
|
||||
const char *param;
|
||||
const char *shuffle;
|
||||
uint32_t plid;
|
||||
uint32_t id;
|
||||
int ret;
|
||||
@ -831,6 +832,9 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
/* Check for shuffle */
|
||||
shuffle = evhttp_find_header(query, "dacp.shufflestate");
|
||||
|
||||
/* Playlist ID */
|
||||
param = evhttp_find_header(query, "container-spec");
|
||||
if (!param)
|
||||
@ -857,6 +861,8 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (!shuffle)
|
||||
{
|
||||
/* Start song ID */
|
||||
param = evhttp_find_header(query, "container-item-spec");
|
||||
if (!param)
|
||||
@ -882,8 +888,11 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
|
||||
|
||||
goto out_fail;
|
||||
}
|
||||
}
|
||||
else
|
||||
id = 0;
|
||||
|
||||
DPRINTF(E_DBG, L_DACP, "Playspec request for playlist %d, start song id %d\n", plid, id);
|
||||
DPRINTF(E_DBG, L_DACP, "Playspec request for playlist %d, start song id %d%s\n", plid, id, (shuffle) ? ", shuffle" : "");
|
||||
|
||||
ps = player_queue_make_pl(plid, &id);
|
||||
if (!ps)
|
||||
@ -903,6 +912,9 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
|
||||
player_queue_clear();
|
||||
player_queue_add(ps);
|
||||
|
||||
if (shuffle)
|
||||
dacp_propset_shufflestate(shuffle, NULL);
|
||||
|
||||
ret = player_playback_start(&id);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
@ -474,6 +474,10 @@ player_queue_make_pl(int plid, uint32_t *id)
|
||||
|
||||
ps = player_queue_make(&qp, NULL);
|
||||
|
||||
/* Shortcut for shuffled playlist */
|
||||
if (*id == 0)
|
||||
return ps;
|
||||
|
||||
p = ps;
|
||||
i = 0;
|
||||
do
|
||||
|
Loading…
Reference in New Issue
Block a user