diff options
author | Romain Bignon <romain@peerfuse.org> | 2010-05-31 23:32:11 +0200 |
---|---|---|
committer | Romain Bignon <romain@peerfuse.org> | 2010-05-31 23:36:16 +0200 |
commit | 867b93a5b2d9c99f35981e3f4622cb2fc06eff99 (patch) | |
tree | 701829cdb56111cad1aa1894e17efdbeac89bab8 | |
parent | 53647c8ba1d7ce54a5caa0c7d414926bf4deb249 (diff) | |
download | mpd-867b93a5b2d9c99f35981e3f4622cb2fc06eff99.tar.gz mpd-867b93a5b2d9c99f35981e3f4622cb2fc06eff99.tar.xz mpd-867b93a5b2d9c99f35981e3f4622cb2fc06eff99.zip |
single mode: at the end of the song, pause on the next song instead of stop
Diffstat (limited to '')
-rw-r--r-- | src/playlist.c | 19 | ||||
-rw-r--r-- | src/playlist_control.c | 2 | ||||
-rw-r--r-- | src/queue.c | 11 |
3 files changed, 13 insertions, 19 deletions
diff --git a/src/playlist.c b/src/playlist.c index e708ce00f..75fd23bf2 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -107,6 +107,12 @@ playlist_sync_with_queue(struct playlist *playlist) playlist->current = playlist->queued; 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) 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->queue.single == 1) - { - if (playlist->queue.repeat == 1) - return queue_order_to_position(&playlist->queue, - playlist->current); - else - return -1; - } - if (playlist->current + 1 < (int)queue_length(&playlist->queue)) + if (playlist->queue.single == 1 && playlist->queue.repeat == 1) + return queue_order_to_position(&playlist->queue, + playlist->current); + else if (playlist->current + 1 < (int)queue_length(&playlist->queue)) return queue_order_to_position(&playlist->queue, playlist->current + 1); else if (playlist->queue.repeat == 1) diff --git a/src/playlist_control.c b/src/playlist_control.c index cd449b425..fa843c89e 100644 --- a/src/playlist_control.c +++ b/src/playlist_control.c @@ -147,8 +147,6 @@ playlist_next(struct playlist *playlist) next_order = queue_next_order(&playlist->queue, playlist->current); if (next_order < 0) { - /* cancel single */ - playlist->queue.single = false; /* no song after this one: stop playback */ playlist_stop(playlist); diff --git a/src/queue.c b/src/queue.c index d847f1138..dd0b48cb5 100644 --- a/src/queue.c +++ b/src/queue.c @@ -44,14 +44,9 @@ queue_next_order(const struct queue *queue, unsigned order) { assert(order < queue->length); - if (queue->single) - { - if (queue->repeat && !queue->consume) - return order; - else - return -1; - } - if (order + 1 < queue->length) + if (queue->single && queue->repeat && !queue->consume) + return order; + else if (order + 1 < queue->length) return order + 1; else if (queue->repeat && (order > 0 || !queue->consume)) /* restart at first song */ |