Add before_item_moved event

This event gets called just before `util.move` with the same arguments
as the `item_moved` event.
This commit is contained in:
Robert Speicher 2014-05-01 20:38:07 -04:00
parent 6cc643520d
commit a7c996d3af
2 changed files with 5 additions and 0 deletions

View file

@ -397,6 +397,8 @@ class Item(LibModel):
plugins.send("item_copied", item=self, source=self.path,
destination=dest)
else:
plugins.send("before_item_moved", item=self, source=self.path,
destination=dest)
util.move(self.path, dest)
plugins.send("item_moved", item=self, source=self.path,
destination=dest)

View file

@ -133,6 +133,9 @@ currently available are:
singleton to the library (not called for full-album imports). Parameters:
``lib``, ``item``
* *before_item_moved*: called with an ``Item`` object immediately before its
file is moved. Parameters: ``item``, ``source`` path, ``destination`` path
* *item_moved*: called with an ``Item`` object whenever its file is moved.
Parameters: ``item``, ``source`` path, ``destination`` path