mirror of
https://github.com/beetbox/beets.git
synced 2026-01-17 05:34:23 +01:00
merge in Lugoues' plugin event changes
This commit is contained in:
commit
dae0d650f8
2 changed files with 13 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
|
||||
|
|
|
|||
7
beets/ui/commands.py
Normal file → Executable file
7
beets/ui/commands.py
Normal file → Executable file
|
|
@ -532,6 +532,9 @@ def apply_choices(lib, copy, write, art, delete, progress):
|
|||
# Write the database after each album.
|
||||
lib.save()
|
||||
|
||||
#annouce that we added an album
|
||||
plugins.send('album_imported', album=albuminfo)
|
||||
|
||||
# Finally, delete old files.
|
||||
if copy and delete:
|
||||
new_paths = [os.path.realpath(item.path) for item in items]
|
||||
|
|
@ -562,6 +565,10 @@ def simple_import(lib, paths, copy, delete, resume):
|
|||
|
||||
album = lib.add_album(items, True)
|
||||
lib.save()
|
||||
|
||||
#annouce that we added an album
|
||||
plugins.send('album_imported', album=album)
|
||||
|
||||
if resume is not False:
|
||||
progress_set(toppath, path)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue