Merge pull request #4146 from kergoth/move-pluginload

This commit is contained in:
Christopher Larson 2021-11-16 08:11:37 -07:00 committed by GitHub
commit b7d0ddf6a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View file

@ -1129,7 +1129,6 @@ def _load_plugins(options, config):
plugin_list = config['plugins'].as_str_seq()
plugins.load_plugins(plugin_list)
plugins.send("pluginload")
return plugins
@ -1145,16 +1144,6 @@ def _setup(options, lib=None):
plugins = _load_plugins(options, config)
# Get the default subcommands.
from beets.ui.commands import default_commands
subcommands = list(default_commands)
subcommands.extend(plugins.commands())
if lib is None:
lib = _open_library(config)
plugins.send("library_opened", lib=lib)
# Add types and queries defined by plugins.
plugin_types_album = plugins.types(library.Album)
library.Album._types.update(plugin_types_album)
@ -1166,6 +1155,18 @@ def _setup(options, lib=None):
library.Item._queries.update(plugins.named_queries(library.Item))
library.Album._queries.update(plugins.named_queries(library.Album))
plugins.send("pluginload")
# Get the default subcommands.
from beets.ui.commands import default_commands
subcommands = list(default_commands)
subcommands.extend(plugins.commands())
if lib is None:
lib = _open_library(config)
plugins.send("library_opened", lib=lib)
return subcommands, plugins, lib

View file

@ -56,6 +56,7 @@ For plugin developers:
* :py:meth:`beets.library.Item.destination` now accepts a `replacements`
argument to be used in favor of the default.
* Send the `pluginload` event after plugin types and queries are available, not before.
Bug fixes: