Skip to content

Commit 73c7cc8

Browse files
committed
Add an 'album_removed' event.
This works similarly to the existing 'item_removed' event but is called with an `Album` object.
1 parent ca1974f commit 73c7cc8

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

beets/library.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ def remove(self, delete=False, with_album=True):
878878
album = self.get_album()
879879
if album and not album.items():
880880
album.remove(delete, False)
881+
plugins.send('album_removed', album=album)
881882

882883
# Send a 'item_removed' signal to plugins
883884
plugins.send('item_removed', item=self)

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Other new things:
5151
yes`` in your configuration to enable.
5252
* :doc:`/plugins/fetchart`: A new option to change cover art format. Useful for
5353
DAPs that do not support some image formats.
54+
* New plugin event: ``album_removed``. Called when an album is removed from the
55+
library (even when its file is not deleted from disk).
5456

5557
For plugin developers:
5658

docs/dev/plugins.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ The events currently available are:
143143
command finishes adding an album to the library. Parameters: ``lib``,
144144
``album``
145145

146+
* `album_removed`: called with an ``Album`` object every time an album is
147+
removed from the library (even when its file is not deleted from disk).
148+
146149
* `item_copied`: called with an ``Item`` object whenever its file is copied.
147150
Parameters: ``item``, ``source`` path, ``destination`` path
148151

0 commit comments

Comments
 (0)