From e81f683a1805871fa671485dc2a6327763ef1cf0 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Mon, 30 Mar 2009 00:01:02 +0200 Subject: implemented the 'consume' mode Consume mode removes each song played --- src/playlist.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/playlist.c') 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; -- cgit v1.2.3