[player] Allow moving by position (dacp-requests) if player is stopped

This commit is contained in:
chme 2016-03-05 08:06:17 +01:00
parent cb919515e4
commit ed2fe682fe
2 changed files with 7 additions and 4 deletions

View File

@ -3429,6 +3429,7 @@ static int
playerqueue_move_bypos(struct player_command *cmd)
{
struct player_source *ps_playing;
uint32_t item_id;
DPRINTF(E_DBG, L_PLAYER, "Moving song from position %d to be the next song after %d\n",
cmd->arg.queue_move_param.from_pos, cmd->arg.queue_move_param.to_pos);
@ -3437,11 +3438,13 @@ playerqueue_move_bypos(struct player_command *cmd)
if (!ps_playing)
{
DPRINTF(E_LOG, L_PLAYER, "Can't move item, no playing item found\n");
return -1;
DPRINTF(E_DBG, L_PLAYER, "No playing item found for move by pos\n");
item_id = 0;
}
else
item_id = ps_playing->item_id;
queue_move_bypos(queue, ps_playing->item_id, cmd->arg.queue_move_param.from_pos, cmd->arg.queue_move_param.to_pos, shuffle);
queue_move_bypos(queue, item_id, cmd->arg.queue_move_param.from_pos, cmd->arg.queue_move_param.to_pos, shuffle);
cur_plversion++;

View File

@ -336,7 +336,7 @@ queueitem_get_bypos(struct queue *queue, unsigned int item_id, unsigned int pos,
return NULL;
i = 0;
for (item = item_base; item != queue->head && i < pos; item = item_next(item, shuffle))
for (item = item_base; i < pos; item = item_next(item, shuffle))
{
i++;
}