single mode: at the end of the song, pause on the next song instead of stop
This commit is contained in:
parent
53647c8ba1
commit
867b93a5b2
@ -107,6 +107,12 @@ playlist_sync_with_queue(struct playlist *playlist)
|
|||||||
playlist->current = playlist->queued;
|
playlist->current = playlist->queued;
|
||||||
playlist->queued = -1;
|
playlist->queued = -1;
|
||||||
|
|
||||||
|
/* Set pause and remove the single mode. */
|
||||||
|
if(playlist->queue.single && !playlist->queue.repeat) {
|
||||||
|
playlist->queue.single = false;
|
||||||
|
pc_set_pause(true);
|
||||||
|
}
|
||||||
|
|
||||||
if(playlist->queue.consume)
|
if(playlist->queue.consume)
|
||||||
playlist_delete(playlist, queue_order_to_position(&playlist->queue, current));
|
playlist_delete(playlist, queue_order_to_position(&playlist->queue, current));
|
||||||
|
|
||||||
@ -393,15 +399,10 @@ playlist_get_next_song(const struct playlist *playlist)
|
|||||||
{
|
{
|
||||||
if (playlist->current >= 0)
|
if (playlist->current >= 0)
|
||||||
{
|
{
|
||||||
if (playlist->queue.single == 1)
|
if (playlist->queue.single == 1 && playlist->queue.repeat == 1)
|
||||||
{
|
|
||||||
if (playlist->queue.repeat == 1)
|
|
||||||
return queue_order_to_position(&playlist->queue,
|
return queue_order_to_position(&playlist->queue,
|
||||||
playlist->current);
|
playlist->current);
|
||||||
else
|
else if (playlist->current + 1 < (int)queue_length(&playlist->queue))
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (playlist->current + 1 < (int)queue_length(&playlist->queue))
|
|
||||||
return queue_order_to_position(&playlist->queue,
|
return queue_order_to_position(&playlist->queue,
|
||||||
playlist->current + 1);
|
playlist->current + 1);
|
||||||
else if (playlist->queue.repeat == 1)
|
else if (playlist->queue.repeat == 1)
|
||||||
|
@ -147,8 +147,6 @@ playlist_next(struct playlist *playlist)
|
|||||||
|
|
||||||
next_order = queue_next_order(&playlist->queue, playlist->current);
|
next_order = queue_next_order(&playlist->queue, playlist->current);
|
||||||
if (next_order < 0) {
|
if (next_order < 0) {
|
||||||
/* cancel single */
|
|
||||||
playlist->queue.single = false;
|
|
||||||
/* no song after this one: stop playback */
|
/* no song after this one: stop playback */
|
||||||
playlist_stop(playlist);
|
playlist_stop(playlist);
|
||||||
|
|
||||||
|
@ -44,14 +44,9 @@ queue_next_order(const struct queue *queue, unsigned order)
|
|||||||
{
|
{
|
||||||
assert(order < queue->length);
|
assert(order < queue->length);
|
||||||
|
|
||||||
if (queue->single)
|
if (queue->single && queue->repeat && !queue->consume)
|
||||||
{
|
|
||||||
if (queue->repeat && !queue->consume)
|
|
||||||
return order;
|
return order;
|
||||||
else
|
else if (order + 1 < queue->length)
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (order + 1 < queue->length)
|
|
||||||
return order + 1;
|
return order + 1;
|
||||||
else if (queue->repeat && (order > 0 || !queue->consume))
|
else if (queue->repeat && (order > 0 || !queue->consume))
|
||||||
/* restart at first song */
|
/* restart at first song */
|
||||||
|
Loading…
Reference in New Issue
Block a user