From 8e17d445ff3b814d6d3c4fba66efd020539ba5f1 Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 12:47:59 +0200 Subject: [PATCH 1/5] Added a check if config_out was empty --- beets/ui/commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 49c4b4dc6..2962362a1 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1691,8 +1691,10 @@ def config_func(lib, opts, args): # Dump configuration. else: config_out = config.dump(full=opts.defaults, redact=opts.redact) - print_(util.text_string(config_out)) - + if config_out != '{}\n': + print_(util.text_string(config_out)) + else: + print("Empty Configuration") def config_edit(): """Open a program to edit the user configuration. From 9c1b39a96e96faffd030f04f43539f39dc1a8e00 Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 12:56:37 +0200 Subject: [PATCH 2/5] had a slight typo --- beets/ui/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 2962362a1..5df0b0c4b 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1694,7 +1694,7 @@ def config_func(lib, opts, args): if config_out != '{}\n': print_(util.text_string(config_out)) else: - print("Empty Configuration") + print("Empty configuration") def config_edit(): """Open a program to edit the user configuration. From 3c8afd9a0e3ea684e2b99c4ac03358ced4711f18 Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 13:07:27 +0200 Subject: [PATCH 3/5] Added the changelog entry --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e33299fab..c752f204b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -6,6 +6,7 @@ Changelog New features: +* When config is printed with no available configuration a new message is printed. * :doc:`/plugins/chroma`: Update file metadata after generating fingerprints through the `submit` command. * :doc:`/plugins/lastgenre`: Added more heavy metal genres: https://en.wikipedia.org/wiki/Heavy_metal_genres to genres.txt and genres-tree.yaml * :doc:`/plugins/subsonicplaylist`: import playlist from a subsonic server. From e898f4396e1dd762602c659dddce305e6347e08e Mon Sep 17 00:00:00 2001 From: Georg Schwitalla Date: Sat, 24 Oct 2020 13:19:29 +0200 Subject: [PATCH 4/5] forgot the second blank line --- beets/ui/commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 5df0b0c4b..efa6e2e16 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1696,6 +1696,7 @@ def config_func(lib, opts, args): else: print("Empty configuration") + def config_edit(): """Open a program to edit the user configuration. An empty config file is created if no existing config file exists. From e49ee7c6867227c809ba2cea5f5e05c3b629bc3c Mon Sep 17 00:00:00 2001 From: Sudo-kun Date: Sun, 25 Oct 2020 11:02:12 +0100 Subject: [PATCH 5/5] Removed white-space sensitivity in the if-clause --- beets/ui/commands.py | 2 +- docs/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index efa6e2e16..f86984350 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1691,7 +1691,7 @@ def config_func(lib, opts, args): # Dump configuration. else: config_out = config.dump(full=opts.defaults, redact=opts.redact) - if config_out != '{}\n': + if config_out.strip() != '{}': print_(util.text_string(config_out)) else: print("Empty configuration") diff --git a/docs/changelog.rst b/docs/changelog.rst index c752f204b..cc86b0292 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,7 @@ Changelog New features: * When config is printed with no available configuration a new message is printed. + :bug: `3779` * :doc:`/plugins/chroma`: Update file metadata after generating fingerprints through the `submit` command. * :doc:`/plugins/lastgenre`: Added more heavy metal genres: https://en.wikipedia.org/wiki/Heavy_metal_genres to genres.txt and genres-tree.yaml * :doc:`/plugins/subsonicplaylist`: import playlist from a subsonic server.