From e591063e827f530bd3bf2e528305888dae81c98f Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 22 Jul 2010 17:09:47 -0700 Subject: [PATCH] "pluginpath" config value --- NEWS | 9 +++++---- beets/ui/__init__.py | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 4b96f5751..7f60deff5 100644 --- a/NEWS +++ b/NEWS @@ -11,10 +11,11 @@ beets command-line interface. The "bpd" and "dadd" commands were removed from the beets core and turned into plugins; BPD is loaded by default. To load the non-default plugins, use the "plugins" config - value (a space-separated list of plugin names). Plugins are just - Python modules under the "beetsplug" namespace package containing - subclasses of beets.plugins.BeetsPlugin. See the "beetsplug" directory - for examples. + value (a space-separated list of plugin names). You can also set the + "pluginpath" config option to a colon-separated list of directories + to search for plugins. Plugins are just Python modules under the + "beetsplug" namespace package containing subclasses of + beets.plugins.BeetsPlugin. See the "beetsplug" directory for examples. * Support for MusicBrainz ID tags. The autotagger now keeps track of the MusicBrainz track, album, and artist IDs it matched for each file. It also looks for album IDs in new files it's importing and uses those to diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 0f53595d4..bc4260414 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -22,6 +22,7 @@ import locale import optparse import textwrap import ConfigParser +import sys from beets import library from beets import plugins @@ -345,6 +346,10 @@ def main(): config = ConfigParser.SafeConfigParser() config.read(CONFIG_FILE) + # Add plugin paths. + plugpaths = config_val(config, 'beets', 'pluginpath', '') + for plugpath in plugpaths.split(':'): + sys.path.append(os.path.expanduser(plugpath)) # Load requested plugins. plugnames = config_val(config, 'beets', 'plugins', '') plugins.load_plugins(plugnames.split())