mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-26 04:49:18 -05:00
added support for the playqueueedit add next command
This commit is contained in:
parent
475a2f4e8f
commit
32c3b57fcd
@ -1311,6 +1311,13 @@ dacp_reply_playqueuecontents(struct evhttp_request *req, struct evbuffer *evbuf,
|
||||
static void
|
||||
dacp_reply_playqueueedit_add(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query)
|
||||
{
|
||||
//?command=add&query='dmap.itemid:156'&sort=album&mode=3&session-id=100
|
||||
// -> mode=3: add to playqueue position 0 (play next)
|
||||
//?command=add&query='dmap.itemid:158'&sort=album&mode=0&session-id=100
|
||||
// -> mode=0: add to end of playqueue
|
||||
//?command=add&query='dmap.itemid:306'&queuefilter=album:6525753023700533274&sort=album&mode=1&session-id=100
|
||||
// -> mode 1: stop playblack, clear playqueue, add songs to playqueue
|
||||
|
||||
struct player_source *ps;
|
||||
const char *editquery;
|
||||
const char *queuefilter;
|
||||
@ -1336,12 +1343,7 @@ dacp_reply_playqueueedit_add(struct evhttp_request *req, struct evbuffer *evbuf,
|
||||
return;
|
||||
}
|
||||
}
|
||||
//?command=add&query='dmap.itemid:156'&sort=album&mode=3&session-id=100
|
||||
// -> mode=3: add to playqueue position 0 (play next)
|
||||
//?command=add&query='dmap.itemid:158'&sort=album&mode=0&session-id=100
|
||||
// -> mode=0: add to end of playqueue
|
||||
//?command=add&query='dmap.itemid:306'&queuefilter=album:6525753023700533274&sort=album&mode=1&session-id=100
|
||||
// -> mode 1: stop playblack, clear playqueue, add songs to playqueue
|
||||
|
||||
if ((mode == 1) || (mode == 2))
|
||||
{
|
||||
player_playback_stop();
|
||||
@ -1387,8 +1389,15 @@ dacp_reply_playqueueedit_add(struct evhttp_request *req, struct evbuffer *evbuf,
|
||||
|
||||
idx = ret;
|
||||
|
||||
if (mode == 3)
|
||||
{
|
||||
player_queue_add_next(ps);
|
||||
}
|
||||
else
|
||||
{
|
||||
player_queue_add(ps);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(E_LOG, L_DACP, "Could not add song queue, DACP query missing\n");
|
||||
|
63
src/player.c
63
src/player.c
@ -3357,7 +3357,46 @@ queue_add(struct player_command *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int queue_move(struct player_command *cmd)
|
||||
static int
|
||||
queue_add_next(struct player_command *cmd)
|
||||
{
|
||||
struct player_source *ps;
|
||||
struct player_source *ps_shuffle;
|
||||
struct player_source *ps_playing;
|
||||
struct player_source *ps_tail;
|
||||
|
||||
ps = cmd->arg.ps;
|
||||
|
||||
ps_shuffle = source_shuffle(ps);
|
||||
if (!ps_shuffle)
|
||||
ps_shuffle = ps;
|
||||
|
||||
if (source_head)
|
||||
{
|
||||
ps_playing = cur_playing ? cur_playing : cur_streaming;
|
||||
ps_tail = ps->pl_prev;
|
||||
|
||||
ps_tail->pl_next = ps_playing->pl_next;
|
||||
ps_tail->shuffle_next = ps_playing->shuffle_next;
|
||||
ps_playing->pl_next = ps;
|
||||
ps_playing->shuffle_next = ps;
|
||||
ps->pl_prev = ps_playing;
|
||||
ps->shuffle_prev = ps_playing;
|
||||
}
|
||||
else
|
||||
{
|
||||
source_head = ps;
|
||||
shuffle_head = ps_shuffle;
|
||||
}
|
||||
|
||||
if (cur_plid != 0)
|
||||
cur_plid = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
queue_move(struct player_command *cmd)
|
||||
{
|
||||
struct player_source *ps_src = NULL;
|
||||
struct player_source *ps_dst = NULL;
|
||||
@ -3421,7 +3460,8 @@ static int queue_move(struct player_command *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int queue_remove(struct player_command *cmd)
|
||||
static int
|
||||
queue_remove(struct player_command *cmd)
|
||||
{
|
||||
struct player_source *ps_src = NULL;
|
||||
|
||||
@ -3930,6 +3970,25 @@ player_queue_add(struct player_source *ps)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
player_queue_add_next(struct player_source *ps)
|
||||
{
|
||||
struct player_command cmd;
|
||||
int ret;
|
||||
|
||||
command_init(&cmd);
|
||||
|
||||
cmd.func = queue_add_next;
|
||||
cmd.func_bh = NULL;
|
||||
cmd.arg.ps = ps;
|
||||
|
||||
ret = sync_command(&cmd);
|
||||
|
||||
command_deinit(&cmd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
player_queue_move(int ps_pos_from, int ps_pos_to)
|
||||
{
|
||||
|
@ -145,6 +145,9 @@ player_queue_get(void);
|
||||
int
|
||||
player_queue_add(struct player_source *ps);
|
||||
|
||||
int
|
||||
player_queue_add_next(struct player_source *ps);
|
||||
|
||||
int
|
||||
player_queue_move(int ps_pos_from, int ps_pos_to);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user