aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_state.c
diff options
context:
space:
mode:
authorRomain Bignon <romain@peerfuse.org>2009-03-27 14:42:55 +0100
committerRomain Bignon <romain@peerfuse.org>2009-03-27 14:58:31 +0100
commite46722b2ebe05fce63bc7b86100c159b5cadd297 (patch)
treec61515a84ad0f425233a7ebe7ee3731ab63df92a /src/playlist_state.c
parent929c200c380996d6dfcbdd468a74aaef48298af6 (diff)
downloadmpd-e46722b2ebe05fce63bc7b86100c159b5cadd297.tar.gz
mpd-e46722b2ebe05fce63bc7b86100c159b5cadd297.tar.xz
mpd-e46722b2ebe05fce63bc7b86100c159b5cadd297.zip
implements the smartstop feature
The smartstop feature is a way to tell mpd to stop playing after current song. This patche provides: - 'state' command returns 'smartstop' state (1 or 0) - 'smartstop' can activate or not the smartstop state - when song is terminated, mpd stops playing and smartstop is set to 0
Diffstat (limited to '')
-rw-r--r--src/playlist_state.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/playlist_state.c b/src/playlist_state.c
index b6636fa54..6d1756eed 100644
--- a/src/playlist_state.c
+++ b/src/playlist_state.c
@@ -34,6 +34,7 @@
#define PLAYLIST_STATE_FILE_STATE "state: "
#define PLAYLIST_STATE_FILE_RANDOM "random: "
#define PLAYLIST_STATE_FILE_REPEAT "repeat: "
+#define PLAYLIST_STATE_FILE_SMARTSTOP "smartstop: "
#define PLAYLIST_STATE_FILE_CURRENT "current: "
#define PLAYLIST_STATE_FILE_TIME "time: "
#define PLAYLIST_STATE_FILE_CROSSFADE "crossfade: "
@@ -71,6 +72,8 @@ playlist_state_save(FILE *fp, const struct playlist *playlist)
playlist->queue.random);
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_REPEAT,
playlist->queue.repeat);
+ fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_SMARTSTOP,
+ playlist->queue.smartstop);
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_CROSSFADE,
(int)(getPlayerCrossFade()));
fprintf(fp, "%s\n", PLAYLIST_STATE_FILE_PLAYLIST_BEGIN);
@@ -129,14 +132,20 @@ playlist_state_restore(FILE *fp, struct playlist *playlist)
} else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_TIME)) {
seek_time =
atoi(&(buffer[strlen(PLAYLIST_STATE_FILE_TIME)]));
- } else
- if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_REPEAT)) {
+ } else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_REPEAT)) {
if (strcmp
(&(buffer[strlen(PLAYLIST_STATE_FILE_REPEAT)]),
"1") == 0) {
setPlaylistRepeatStatus(playlist, true);
} else
setPlaylistRepeatStatus(playlist, false);
+ } else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_SMARTSTOP)) {
+ if (strcmp
+ (&(buffer[strlen(PLAYLIST_STATE_FILE_SMARTSTOP)]),
+ "1") == 0) {
+ setPlaylistSmartstopStatus(playlist, true);
+ } else
+ setPlaylistSmartstopStatus(playlist, false);
} else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_CROSSFADE)) {
setPlayerCrossFade(atoi
(&