From 3bb068a67594dcbc8b52acd1ccbc838262fd7cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Sat, 25 Oct 2025 13:14:45 +0100 Subject: [PATCH] Warn users of deprecated musicbrainz.enabled option --- beets/plugins.py | 13 ++++++++----- beets/util/deprecation.py | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/beets/plugins.py b/beets/plugins.py index 8ae9c40a7..b75581796 100644 --- a/beets/plugins.py +++ b/beets/plugins.py @@ -415,16 +415,19 @@ def get_plugin_names() -> list[str]: sys.path += paths plugins = unique_list(beets.config["plugins"].as_str_seq()) # TODO: Remove in v3.0.0 - if ( - "musicbrainz" not in plugins - and beets.config["musicbrainz"].flatten().get("enabled") is not False - ): + if "musicbrainz" not in plugins: deprecate_for_user( log, "Automatic loading of 'musicbrainz' plugin", "'plugins' configuration to explicitly add 'musicbrainz'", ) - plugins.append("musicbrainz") + enabled = beets.config["musicbrainz"].flatten().get("enabled") + if enabled is not None: + deprecate_for_user( + log, "'musicbrainz.enabled' configuration option" + ) + if enabled is not False: + plugins.append("musicbrainz") beets.config.add({"disabled_plugins": []}) disabled_plugins = set(beets.config["disabled_plugins"].as_str_seq()) diff --git a/beets/util/deprecation.py b/beets/util/deprecation.py index 31f4f5eb2..b9ffeae82 100644 --- a/beets/util/deprecation.py +++ b/beets/util/deprecation.py @@ -21,7 +21,9 @@ def _format_message(old: str, new: str | None = None) -> str: return msg -def deprecate_for_user(logger: Logger, old: str, new: str) -> None: +def deprecate_for_user( + logger: Logger, old: str, new: str | None = None +) -> None: logger.warning(_format_message(old, new))