From 0b61237858bf44bbabb245219b7ed048afd46b24 Mon Sep 17 00:00:00 2001 From: Patrick Gaskin Date: Wed, 23 Oct 2024 19:52:12 -0400 Subject: [PATCH 1/2] Apply new formats from #1317 on upgrade New formats for the statusline, headings, and trackwin were introduced to streamline the interface and make better use of new features. Update the config to the new defaults if we're upgrading from an old version of cmus (identified by the lack of the newly added format options in the autosave) after loading the autosave, but before loading the user's rc (yes, this does mean that if the user set a custom one via the command line rather than the rc, the user will have to reconfigure it). See c454d4e4683143ed8fae9b4ba73ef215e8026e36, bad9b0c4291ad6a5e9f5de0e14a533ebd661ef41. --- options.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/options.c b/options.c index 0ac0d953..155e358e 100644 --- a/options.c +++ b/options.c @@ -299,6 +299,8 @@ static const struct { { NULL, NULL } }; +static int seen_pr1317_fmts = 0; + /* callbacks for normal options {{{ */ static void get_device(void *data, char *buf, size_t size) @@ -1594,6 +1596,9 @@ static void set_format(void *data, const char *buf) { char **fmtp = data; + if (fmtp == id_to_fmt(FMT_HEADING_ALBUM) || fmtp == id_to_fmt(FMT_HEADING_ARTIST) || fmtp == id_to_fmt(FMT_HEADING_PLAYLIST)) + seen_pr1317_fmts = 1; + if (!track_format_valid(buf)) { error_msg("invalid format string"); return; @@ -1835,6 +1840,9 @@ void options_load(void) for (i = 0; str_defaults[i].name; i++) option_set(str_defaults[i].name, str_defaults[i].value); + /* reset the flag before loading the autosave */ + seen_pr1317_fmts = 0; + /* load autosave config */ snprintf(filename, sizeof(filename), "%s/autosave", cmus_config_dir); if (source_file(filename) == -1) { @@ -1850,6 +1858,15 @@ void options_load(void) free(def); } + /* replace old format with new one if upgrading past PR #1317 */ + if (!seen_pr1317_fmts) { + option_set(str_defaults[FMT_STATUSLINE].name, str_defaults[FMT_STATUSLINE].value); + option_set(str_defaults[FMT_PLAYLIST_ALT].name, str_defaults[FMT_PLAYLIST_ALT].value); + option_set(str_defaults[FMT_TRACKWIN_ALBUM].name, str_defaults[FMT_TRACKWIN_ALBUM].value); + option_set(str_defaults[FMT_TRACKWIN].name, str_defaults[FMT_TRACKWIN].value); + option_set(str_defaults[FMT_TRACKWIN_VA].name, str_defaults[FMT_TRACKWIN_VA].value); + } + /* load optional static config */ snprintf(filename, sizeof(filename), "%s/rc", cmus_config_dir); if (source_file(filename) == -1) { From 58d34cf9db5c29e01a985a48a9b6947855cb6cc9 Mon Sep 17 00:00:00 2001 From: Gregory Petrosyan Date: Sat, 26 Oct 2024 13:27:42 +0300 Subject: [PATCH 2/2] cmus 2.12.0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d6f264e8..76a4d59f 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ _ver1 = $(shell git describe --tags $(REV) 2>/dev/null) # SHA1 _ver2 = $(shell git rev-parse --verify --short $(REV) 2>/dev/null) # hand-made -_ver3 = v2.11.0 +_ver3 = v2.12.0 VERSION = $(or $(_ver0),$(_ver1),$(_ver2),$(_ver3))