From d5507dc956e72defe3e67e7eba0f5b6f8c267cbe Mon Sep 17 00:00:00 2001 From: Carl Suster Date: Sat, 20 Apr 2019 18:13:28 +1000 Subject: [PATCH] docs: remove reference to BeetsPlugin.listen This decorator was removed in 4578c4f0e1659daab8d25c79d1f466ae9838d8c7 and now `BeetsPlugin.register_listener` should be used instead. Fixes #2885. --- docs/dev/plugins.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/dev/plugins.rst b/docs/dev/plugins.rst index c9018c394..745c8340a 100644 --- a/docs/dev/plugins.rst +++ b/docs/dev/plugins.rst @@ -103,19 +103,18 @@ operation. For instance, a plugin could write a log message every time an album is successfully autotagged or update MPD's index whenever the database is changed. -You can "listen" for events using the ``BeetsPlugin.listen`` decorator. Here's +You can "listen" for events using ``BeetsPlugin.register_listener``. Here's an example:: from beets.plugins import BeetsPlugin - class SomePlugin(BeetsPlugin): - pass - - @SomePlugin.listen('pluginload') def loaded(): print 'Plugin loaded!' -Pass the name of the event in question to the ``listen`` decorator. + class SomePlugin(BeetsPlugin): + def __init__(self): + super(SomePlugin, self).__init__() + self.register_listener('pluginload', loaded) Note that if you want to access an attribute of your plugin (e.g. ``config`` or ``log``) you'll have to define a method and not a function. Here is the usual