aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/playlist_state.c14
2 files changed, 10 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 94941fc21..fc702032a 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ ver 0.16 (20??/??/??)
* commands:
- added new "status" line with more precise "elapsed time"
* log unused/unknown block parameters
+* save state when stopped
ver 0.15 (2009/06/23)
diff --git a/src/playlist_state.c b/src/playlist_state.c
index af0f7982b..9530b7d36 100644
--- a/src/playlist_state.c
+++ b/src/playlist_state.c
@@ -66,8 +66,12 @@ playlist_state_save(FILE *fp, const struct playlist *playlist)
playlist->current));
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_TIME,
getPlayerElapsedTime());
- } else
+ } else {
fprintf(fp, "%s\n", PLAYLIST_STATE_FILE_STATE_STOP);
+ fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_CURRENT,
+ queue_order_to_position(&playlist->queue,
+ playlist->current));
+ }
fprintf(fp, "%s%i\n", PLAYLIST_STATE_FILE_RANDOM,
playlist->queue.random);
@@ -172,19 +176,19 @@ playlist_state_restore(FILE *fp, struct playlist *playlist)
(PLAYLIST_STATE_FILE_CURRENT)]));
} else if (g_str_has_prefix(buffer,
PLAYLIST_STATE_FILE_PLAYLIST_BEGIN)) {
- if (state == PLAYER_STATE_STOP)
- current = -1;
playlist_state_load(fp, playlist, buffer);
}
}
setPlaylistRandomStatus(playlist, random_mode);
- if (state != PLAYER_STATE_STOP && !queue_is_empty(&playlist->queue)) {
+ if (!queue_is_empty(&playlist->queue)) {
if (!queue_valid_position(&playlist->queue, current))
current = 0;
- if (seek_time == 0)
+ if (state == PLAYER_STATE_STOP /* && config_option */)
+ playlist->current = current;
+ else if (seek_time == 0)
playPlaylist(playlist, current);
else
seekSongInPlaylist(playlist, current, seek_time);