diff options
author | Romain Bignon <romain@peerfuse.org> | 2009-03-27 14:42:55 +0100 |
---|---|---|
committer | Romain Bignon <romain@peerfuse.org> | 2009-03-27 14:58:31 +0100 |
commit | e46722b2ebe05fce63bc7b86100c159b5cadd297 (patch) | |
tree | c61515a84ad0f425233a7ebe7ee3731ab63df92a /src/playlist_state.c | |
parent | 929c200c380996d6dfcbdd468a74aaef48298af6 (diff) | |
download | mpd-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 'src/playlist_state.c')
-rw-r--r-- | src/playlist_state.c | 13 |
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 (& |