Implement jumping in DACP cue play command

This commit is contained in:
Julien BLACHE 2010-05-01 10:07:06 +02:00
parent c11752e9a6
commit d38db5868c

View File

@ -637,37 +637,40 @@ dacp_reply_ctrlint(struct evhttp_request *req, struct evbuffer *evbuf, char **ur
static void static void
dacp_reply_cue_play(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query) dacp_reply_cue_play(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query)
{ {
struct player_status status;
struct player_source *ps;
const char *sort; const char *sort;
const char *cuequery; const char *cuequery;
const char *param; const char *param;
struct player_source *ps;
uint32_t id; uint32_t id;
int ret; int ret;
/* /cue?command=play&query=...&sort=...&index=N */ /* /cue?command=play&query=...&sort=...&index=N */
cuequery = evhttp_find_header(query, "query"); cuequery = evhttp_find_header(query, "query");
if (!cuequery) if (cuequery)
{ {
DPRINTF(E_LOG, L_DACP, "No query given for cue play command\n"); sort = evhttp_find_header(query, "sort");
dmap_send_error(req, "cacr", "No query given"); ps = player_queue_make(cuequery, sort);
return; if (!ps)
{
DPRINTF(E_LOG, L_DACP, "Could not build song queue\n");
dmap_send_error(req, "cacr", "Could not build song queue");
return;
}
player_queue_add(ps);
} }
else
sort = evhttp_find_header(query, "sort");
ps = player_queue_make(cuequery, sort);
if (!ps)
{ {
DPRINTF(E_LOG, L_DACP, "Could not build song queue\n"); player_get_status(&status);
dmap_send_error(req, "cacr", "Could not build song queue"); if (status.status != PLAY_STOPPED)
return; player_playback_stop();
} }
player_queue_add(ps);
param = evhttp_find_header(query, "dacp.shufflestate"); param = evhttp_find_header(query, "dacp.shufflestate");
if (param) if (param)
dacp_propset_shufflestate(param); dacp_propset_shufflestate(param);