From 92279ef33d70b93dd8238d4624be5239615174bb Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 6 Mar 2022 10:01:15 +0100 Subject: [PATCH] [library] Move clear_queue_on_stop_disable cfg option to library section Resolves #1430 --- owntone.conf.in | 12 ++++++------ src/conffile.c | 3 ++- src/library.c | 10 +++++++++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/owntone.conf.in b/owntone.conf.in index 12390f55..38f59ebe 100644 --- a/owntone.conf.in +++ b/owntone.conf.in @@ -219,6 +219,12 @@ library { # playlist directory. OwnTone creates new playlists in this directory if only # a playlist name is provided (requires "allow_modify_stored_playlists" set to true). # default_playlist_directory = "" + + # By default OwnTone will - like iTunes - clear the playqueue if + # playback stops. Setting clear_queue_on_stop_disable to true will keep + # the playlist like MPD does. Note that some dacp clients do not show + # the playqueue if playback is stopped. +# clear_queue_on_stop_disable = false } # Local audio output @@ -410,12 +416,6 @@ mpd { # clients and will need additional configuration in the MPD client to # work). Set to 0 to disable serving artwork over http. # http_port = 0 - - # By default OwnTone will - like iTunes - clear the playqueue if - # playback stops. Setting clear_queue_on_stop_disable to true will keep - # the playlist like MPD does. Note that some dacp clients do not show - # the playqueue if playback is stopped. -# clear_queue_on_stop_disable = false } # SQLite configuration (allows to modify the operation of the SQLite databases) diff --git a/src/conffile.c b/src/conffile.c index b41085e3..97d67e38 100644 --- a/src/conffile.c +++ b/src/conffile.c @@ -117,6 +117,7 @@ static cfg_opt_t sec_library[] = CFG_BOOL("rating_updates", cfg_false, CFGF_NONE), CFG_BOOL("allow_modifying_stored_playlists", cfg_false, CFGF_NONE), CFG_STR("default_playlist_directory", NULL, CFGF_NONE), + CFG_BOOL("clear_queue_on_stop_disable", cfg_false, CFGF_NONE), CFG_END() }; @@ -225,7 +226,7 @@ static cfg_opt_t sec_mpd[] = { CFG_INT("port", 6600, CFGF_NONE), CFG_INT("http_port", 0, CFGF_NONE), - CFG_BOOL("clear_queue_on_stop_disable", cfg_false, CFGF_NONE), + CFG_BOOL("clear_queue_on_stop_disable", cfg_false, CFGF_NODEFAULT | CFGF_DEPRECATED), CFG_BOOL("allow_modifying_stored_playlists", cfg_false, CFGF_NODEFAULT | CFGF_DEPRECATED), CFG_STR("default_playlist_directory", NULL, CFGF_NODEFAULT | CFGF_DEPRECATED), CFG_END() diff --git a/src/library.c b/src/library.c index f44f1f90..4463d9a6 100644 --- a/src/library.c +++ b/src/library.c @@ -715,7 +715,15 @@ initscan() listener_notify(LISTENER_UPDATE); // Only clear the queue if enabled (default) in config - clear_queue_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable"); + clear_queue_disabled = cfg_getbool(cfg_getsec(cfg, "library"), "clear_queue_on_stop_disable"); + + /* Handle deprecated config options */ + if (0 < cfg_opt_size(cfg_getopt(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable"))) + { + DPRINTF(E_LOG, L_MPD, "Found deprecated option 'clear_queue_on_stop_disable' in section 'mpd', please update configuration file (move option to section 'library').\n"); + clear_queue_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable"); + } + if (!clear_queue_disabled) { db_queue_clear(0);