aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_state.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_state.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_state.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/playlist_state.c b/src/playlist_state.c
index f5b1456d7..af0f7982b 100644
--- a/src/playlist_state.c
+++ b/src/playlist_state.c
@@ -35,6 +35,7 @@
#define PLAYLIST_STATE_FILE_RANDOM "random: "
#define PLAYLIST_STATE_FILE_REPEAT "repeat: "
#define PLAYLIST_STATE_FILE_SINGLE "single: "
+#define PLAYLIST_STATE_FILE_CONSUME "consume: "
#define PLAYLIST_STATE_FILE_CURRENT "current: "
#define PLAYLIST_STATE_FILE_TIME "time: "
#define PLAYLIST_STATE_FILE_CROSSFADE "crossfade: "
@@ -74,6 +75,8 @@ playlist_state_save(FILE *fp, const struct playlist *playlist)
playlist->queue.repeat);
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_SINGLE,
playlist->queue.single);
+ fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_CONSUME,
+ playlist->queue.consume);
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_CROSSFADE,
(int)(getPlayerCrossFade()));
fprintf(fp, "%s\n", PLAYLIST_STATE_FILE_PLAYLIST_BEGIN);
@@ -146,6 +149,13 @@ playlist_state_restore(FILE *fp, struct playlist *playlist)
setPlaylistSingleStatus(playlist, true);
} else
setPlaylistSingleStatus(playlist, false);
+ } else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_CONSUME)) {
+ if (strcmp
+ (&(buffer[strlen(PLAYLIST_STATE_FILE_CONSUME)]),
+ "1") == 0) {
+ setPlaylistConsumeStatus(playlist, true);
+ } else
+ setPlaylistConsumeStatus(playlist, false);
} else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_CROSSFADE)) {
setPlayerCrossFade(atoi
(&