Deprecate musicbrainz.enabled configuration

This commit is contained in:
Šarūnas Nejus 2025-04-22 15:12:59 +01:00
parent 874fb3da7b
commit e981fb1aea
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
3 changed files with 19 additions and 3 deletions

View file

@ -17,6 +17,8 @@ interface. To invoke the CLI, just call beets.ui.main(). The actual
CLI commands are implemented in the ui.commands module. CLI commands are implemented in the ui.commands module.
""" """
from __future__ import annotations
import errno import errno
import optparse import optparse
import os.path import os.path
@ -27,7 +29,7 @@ import sys
import textwrap import textwrap
import traceback import traceback
from difflib import SequenceMatcher from difflib import SequenceMatcher
from typing import Any, Callable from typing import TYPE_CHECKING, Any, Callable
import confuse import confuse
@ -37,6 +39,9 @@ from beets.dbcore import query as db_query
from beets.util import as_string from beets.util import as_string
from beets.util.functemplate import template from beets.util.functemplate import template
if TYPE_CHECKING:
from types import ModuleType
# On Windows platforms, use colorama to support "ANSI" terminal colors. # On Windows platforms, use colorama to support "ANSI" terminal colors.
if sys.platform == "win32": if sys.platform == "win32":
try: try:
@ -569,7 +574,7 @@ COLOR_NAMES = [
"text_diff_removed", "text_diff_removed",
"text_diff_changed", "text_diff_changed",
] ]
COLORS = None COLORS: dict[str, list[str]] | None = None
def _colorize(color, text): def _colorize(color, text):
@ -1622,7 +1627,9 @@ optparse.Option.ALWAYS_TYPED_ACTIONS += ("callback",)
# The main entry point and bootstrapping. # The main entry point and bootstrapping.
def _load_plugins(options, config): def _load_plugins(
options: optparse.Values, config: confuse.LazyConfig
) -> ModuleType:
"""Load the plugins specified on the command line or in the configuration.""" """Load the plugins specified on the command line or in the configuration."""
paths = config["pluginpath"].as_str_seq(split=False) paths = config["pluginpath"].as_str_seq(split=False)
paths = [util.normpath(p) for p in paths] paths = [util.normpath(p) for p in paths]
@ -1647,6 +1654,11 @@ def _load_plugins(options, config):
) )
else: else:
plugin_list = config["plugins"].as_str_seq() plugin_list = config["plugins"].as_str_seq()
# TODO: Remove in v2.4 or v3
if "musicbrainz" in config and config["musicbrainz"].get().get(
"enabled"
):
plugin_list.append("musicbrainz")
# Exclude any plugins that were specified on the command line # Exclude any plugins that were specified on the command line
if options.exclude is not None: if options.exclude is not None:

View file

@ -40,6 +40,7 @@ New features:
a separate plugin. The default :ref:`plugins-config` includes `musicbrainz`, a separate plugin. The default :ref:`plugins-config` includes `musicbrainz`,
but if you've customized your `plugins` list in your configuration, you'll but if you've customized your `plugins` list in your configuration, you'll
need to explicitly add `musicbrainz` to continue using this functionality. need to explicitly add `musicbrainz` to continue using this functionality.
Configuration option `musicbrainz.enabled` has thus been deprecated.
:bug:`2686` :bug:`2686`
:bug:`4605` :bug:`4605`
* :doc:`plugins/lastgenre`: The new configuration option, ``keep_existing``, * :doc:`plugins/lastgenre`: The new configuration option, ``keep_existing``,

View file

@ -71,6 +71,9 @@ to one request per second.
enabled enabled
~~~~~~~ ~~~~~~~
.. deprecated:: 2.3
Add `musicbrainz` to the `plugins` list instead.
This option allows you to disable using MusicBrainz as a metadata source. This applies This option allows you to disable using MusicBrainz as a metadata source. This applies
if you use plugins that fetch data from alternative sources and should make the import if you use plugins that fetch data from alternative sources and should make the import
process quicker. process quicker.