mirror of
https://github.com/beetbox/beets.git
synced 2026-01-16 21:25:14 +01:00
added register_listeners method to BeetsPlugin class
This commit is contained in:
parent
f0cc11e8ff
commit
4a30ad6bbc
1 changed files with 6 additions and 0 deletions
6
beets/plugins.py
Normal file → Executable file
6
beets/plugins.py
Normal file → Executable file
|
|
@ -64,6 +64,12 @@ class BeetsPlugin(object):
|
|||
pass
|
||||
|
||||
listeners = None
|
||||
|
||||
def register_listener(self, event, func):
|
||||
if self.listeners is None:
|
||||
self.listeners = defaultdict(list)
|
||||
self.listeners[event].append(func)
|
||||
|
||||
@classmethod
|
||||
def listen(cls, event):
|
||||
"""Decorator that adds a function as an event handler for the
|
||||
|
|
|
|||
Loading…
Reference in a new issue