Hi! At the moment mpd doesn't store or restore the current track to/from its state file when the daemon is stopped/started while in 'stopped' state. I believe the preferred behaviour would be to store and restore the current track even when the daemon is in stopped state when shutting down. I made a small patch to adapt this behaviour. If you believe this is not the preferred behaviour, maybe this should be realized as a configuration option. I'm not sure how to do this, but made a small comment, where one would have to put the option. I would be glad, if this patch would be merged into the development tree. Since I'm not on the list, please cc me in your replies.
Regards,
Christopher Zimmermann
--- a/playlist_state.c 2009-05-08 12:30:24.000000000 +0200
+++ b/playlist_state.c 2009-06-21 15:17:16.000000000 +0200
@@ -66,8 +66,12 @@
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_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);
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________ Musicpd-dev-team mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
