playlist_state: add option "restore_paused"

When set, MPD will not auto-start playback on startup; it will be in
"paused" state.
This commit is contained in:
Max Kellermann
2011-02-23 09:09:48 +01:00
parent b57330cf75
commit 2fb40fe728
5 changed files with 18 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ static struct config_entry config_entries[] = {
{ .name = CONF_LOG_FILE, false, false },
{ .name = CONF_PID_FILE, false, false },
{ .name = CONF_STATE_FILE, false, false },
{ .name = "restore_paused", false, false },
{ .name = CONF_USER, false, false },
{ .name = CONF_GROUP, false, false },
{ .name = CONF_BIND_TO_ADDRESS, true, false },

View File

@@ -29,6 +29,7 @@
#include "queue_save.h"
#include "path.h"
#include "text_file.h"
#include "conf.h"
#include <string.h>
#include <stdlib.h>
@@ -196,6 +197,13 @@ playlist_state_restore(const char *line, FILE *fp, GString *buffer,
if (!queue_valid_position(&playlist->queue, current))
current = 0;
if (state == PLAYER_STATE_PLAY &&
config_get_bool("restore_paused", false))
/* the user doesn't want MPD to auto-start
playback after startup; fall back to
"pause" */
state = PLAYER_STATE_PAUSE;
/* enable all devices for the first time; this must be
called here, after the audio output states were
restored, before playback begins */