aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_control.c
diff options
context:
space:
mode:
authorRomain Bignon <romain@peerfuse.org>2009-03-30 00:01:02 +0200
committerRomain Bignon <romain@peerfuse.org>2009-03-30 17:37:55 +0200
commite81f683a1805871fa671485dc2a6327763ef1cf0 (patch)
treeb2fe3b82caf9b77dcabf2b475d10f34d20445a69 /src/playlist_control.c
parent7d9380fd913355b70f846a4adc263363d12813ba (diff)
downloadmpd-e81f683a1805871fa671485dc2a6327763ef1cf0.tar.gz
mpd-e81f683a1805871fa671485dc2a6327763ef1cf0.tar.xz
mpd-e81f683a1805871fa671485dc2a6327763ef1cf0.zip
implemented the 'consume' mode
Consume mode removes each song played
Diffstat (limited to '')
-rw-r--r--src/playlist_control.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/playlist_control.c b/src/playlist_control.c
index 9e31c07ab..4f51345c3 100644
--- a/src/playlist_control.c
+++ b/src/playlist_control.c
@@ -139,6 +139,7 @@ void
nextSongInPlaylist(struct playlist *playlist)
{
int next_order;
+ int current;
if (!playlist->playing)
return;
@@ -146,6 +147,7 @@ nextSongInPlaylist(struct playlist *playlist)
assert(!queue_is_empty(&playlist->queue));
assert(queue_valid_order(&playlist->queue, playlist->current));
+ current = playlist->current;
playlist->stop_on_error = false;
/* determine the next song from the queue's order list */
@@ -156,24 +158,29 @@ nextSongInPlaylist(struct playlist *playlist)
playlist->queue.single = false;
/* no song after this one: stop playback */
stopPlaylist(playlist);
- return;
}
+ else
+ {
+ if (next_order == 0 && playlist->queue.random) {
+ /* The queue told us that the next song is the first
+ song. This means we are in repeat mode. Shuffle
+ the queue order, so this time, the user hears the
+ songs in a different than before */
+ assert(playlist->queue.repeat);
+
+ queue_shuffle_order(&playlist->queue);
+
+ /* note that playlist->current and playlist->queued are
+ now invalid, but playPlaylistOrderNumber() will
+ discard them anyway */
+ }
- if (next_order == 0 && playlist->queue.random) {
- /* The queue told us that the next song is the first
- song. This means we are in repeat mode. Shuffle
- the queue order, so this time, the user hears the
- songs in a different than before */
- assert(playlist->queue.repeat);
-
- queue_shuffle_order(&playlist->queue);
-
- /* note that playlist->current and playlist->queued are
- now invalid, but playPlaylistOrderNumber() will
- discard them anyway */
+ playPlaylistOrderNumber(playlist, next_order);
}
- playPlaylistOrderNumber(playlist, next_order);
+ /* Consume mode removes each played songs. */
+ if(playlist->queue.consume)
+ deleteFromPlaylist(playlist, queue_order_to_position(&playlist->queue, current));
}
void previousSongInPlaylist(struct playlist *playlist)