Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions beets/plugins.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def configure(self, config):
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
Expand Down
7 changes: 7 additions & 0 deletions beets/ui/commands.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)

Expand Down