mirror of
https://github.com/beetbox/beets.git
synced 2025-12-30 04:22:40 +01:00
Update _types field instead of assigning it
Assigning it would override our pre-defined types (such as `path` in Album._types)
This commit is contained in:
parent
049aa2f297
commit
3ec44aab3e
2 changed files with 9 additions and 6 deletions
|
|
@ -839,8 +839,8 @@ def _setup(options, lib=None):
|
|||
if lib is None:
|
||||
lib = _open_library(config)
|
||||
plugins.send("library_opened", lib=lib)
|
||||
library.Item._types = plugins.types(library.Item)
|
||||
library.Album._types = plugins.types(library.Album)
|
||||
library.Item._types.update(plugins.types(library.Item))
|
||||
library.Album._types.update(plugins.types(library.Album))
|
||||
|
||||
return subcommands, plugins, lib
|
||||
|
||||
|
|
|
|||
|
|
@ -199,8 +199,11 @@ class TestHelper(object):
|
|||
beets.config['plugins'] = plugins
|
||||
beets.plugins.load_plugins(plugins)
|
||||
beets.plugins.find_plugins()
|
||||
Item._types = beets.plugins.types(Item)
|
||||
Album._types = beets.plugins.types(Album)
|
||||
# Take a backup of the original _types to restore when unloading
|
||||
Item._original_types = dict(Item._types)
|
||||
Album._original_types = dict(Album._types)
|
||||
Item._types.update(beets.plugins.types(Item))
|
||||
Album._types.update(beets.plugins.types(Album))
|
||||
|
||||
def unload_plugins(self):
|
||||
"""Unload all plugins and remove the from the configuration.
|
||||
|
|
@ -209,8 +212,8 @@ class TestHelper(object):
|
|||
beets.config['plugins'] = []
|
||||
beets.plugins._classes = set()
|
||||
beets.plugins._instances = {}
|
||||
Item._types = {}
|
||||
Album._types = {}
|
||||
Item._types = Item._original_types
|
||||
Album._types = Album._original_types
|
||||
|
||||
def create_importer(self, item_count=1, album_count=1):
|
||||
"""Create files to import and return corresponding session.
|
||||
|
|
|
|||
Loading…
Reference in a new issue