diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 8c35deca0..f2d298b41 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -431,6 +431,20 @@ def get_replacements(): )) return replacements +def get_plugin_paths(): + """Get the list of search paths for plugins from the config file. + The value for "pluginpath" may be a single string or a list of + strings. + """ + pluginpaths = config['pluginpath'].get() + if isinstance(pluginpaths, basestring): + pluginpaths = [pluginpaths] + if not isinstance(pluginpaths, list): + raise confit.ConfigTypeError( + u'pluginpath must be string or a list of strings' + ) + return map(util.normpath, pluginpaths) + def _pick_format(album, fmt=None): """Pick a format string for printing Album or Item objects, falling back to config options and defaults. @@ -640,8 +654,7 @@ def _raw_main(args, load_config=True): from beets.ui.commands import default_commands # Add plugin paths. - for plugpath in config['pluginpath'].as_str_seq(): - sys.path.append(os.path.expanduser(plugpath)) + sys.path += get_plugin_paths() # Load requested plugins. plugins.load_plugins(config['plugins'].as_str_seq()) plugins.send("pluginload") diff --git a/beets/ui/migrate.py b/beets/ui/migrate.py index f00719bd1..fa4a46271 100644 --- a/beets/ui/migrate.py +++ b/beets/ui/migrate.py @@ -184,6 +184,10 @@ def transform_data(data): replacements[pat] = repl out['replace'] = replacements + elif key == 'pluginpath': + # Used to be a colon-separated string. Now a list. + out['pluginpath'] = value.split(':') + else: out[key] = value diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 265b29d21..4a8311f08 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -54,9 +54,15 @@ includes the BPD plugin for playing music. pluginpath ~~~~~~~~~~ -A colon-separated list of directories to search for plugins. These paths -are just added to ``sys.path`` before the plugins are loaded. The plugins -still have to be contained in a ``beetsplug`` namespace package. +Directories to search for plugins. These paths are just added to ``sys.path`` +before the plugins are loaded. (The plugins still have to be contained in a +``beetsplug`` namespace package.) This can either be a single string or a list +of strings---so, if you have multiple paths, format them as a YAML list like +so:: + + pluginpath: + - /path/one + - /path/two ignore ~~~~~~