MCPcopy
hub / github.com/beetbox/beets / get_plugin_names

Function get_plugin_names

beets/plugins.py:379–417  ·  view source on GitHub ↗

Discover and return the set of plugin names to be loaded. Configures the plugin search paths and resolves the final set of plugins based on configuration settings, inclusion filters, and exclusion rules. Automatically includes the musicbrainz plugin when enabled in configuration.

()

Source from the content-addressed store, hash-verified

377
378
379def get_plugin_names() -> list[str]:
380 """Discover and return the set of plugin names to be loaded.
381
382 Configures the plugin search paths and resolves the final set of plugins
383 based on configuration settings, inclusion filters, and exclusion rules.
384 Automatically includes the musicbrainz plugin when enabled in configuration.
385 """
386 paths = [
387 str(Path(p).expanduser().absolute())
388 for p in beets.config["pluginpath"].as_str_seq(split=False)
389 ]
390 log.debug("plugin paths: {}", paths)
391
392 # Extend the `beetsplug` package to include the plugin paths.
393 import beetsplug
394
395 beetsplug.__path__ = paths + list(beetsplug.__path__)
396
397 # For backwards compatibility, also support plugin paths that
398 # *contain* a `beetsplug` package.
399 sys.path += paths
400 plugins = unique_list(beets.config["plugins"].as_str_seq())
401 beets.config.add({"disabled_plugins": []})
402 disabled_plugins = set(beets.config["disabled_plugins"].as_str_seq())
403 # TODO: Remove in v3.0.0
404 mb_enabled = beets.config["musicbrainz"].flatten().get("enabled")
405 if mb_enabled:
406 deprecate_for_user(
407 log,
408 "'musicbrainz.enabled' configuration option",
409 "'plugins' configuration to explicitly add 'musicbrainz'",
410 )
411 if "musicbrainz" not in plugins:
412 plugins.append("musicbrainz")
413 elif mb_enabled is False:
414 deprecate_for_user(log, "'musicbrainz.enabled' configuration option")
415 disabled_plugins.add("musicbrainz")
416
417 return [p for p in plugins if p not in disabled_plugins]
418
419
420def _get_plugin(name: str) -> BeetsPlugin | None:

Callers 1

load_pluginsFunction · 0.85

Calls 5

unique_listFunction · 0.90
deprecate_for_userFunction · 0.90
debugMethod · 0.45
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected