aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.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.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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 776308db0..79f6022a5 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -100,9 +100,13 @@ static void syncPlaylistWithQueue(struct playlist *playlist)
/* queued song has started: copy queued to current,
and notify the clients */
+ int current = playlist->current;
playlist->current = playlist->queued;
playlist->queued = -1;
+ if(playlist->queue.consume)
+ deleteFromPlaylist(playlist, queue_order_to_position(&playlist->queue, current));
+
idle_add(IDLE_PLAYER);
}
}
@@ -267,6 +271,12 @@ getPlaylistSingleStatus(const struct playlist *playlist)
return playlist->queue.single;
}
+bool
+getPlaylistConsumeStatus(const struct playlist *playlist)
+{
+ return playlist->queue.consume;
+}
+
void setPlaylistRepeatStatus(struct playlist *playlist, bool status)
{
if (status == playlist->queue.repeat)
@@ -307,6 +317,15 @@ void setPlaylistSingleStatus(struct playlist *playlist, bool status)
idle_add(IDLE_OPTIONS);
}
+void setPlaylistConsumeStatus(struct playlist *playlist, bool status)
+{
+ if (status == playlist->queue.consume)
+ return;
+
+ playlist->queue.consume = status;
+ idle_add(IDLE_OPTIONS);
+}
+
void setPlaylistRandomStatus(struct playlist *playlist, bool status)
{
const struct song *queued;