From a7c996d3af99390057a159fb9483d44eb413f9a7 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 1 May 2014 20:38:07 -0400 Subject: [PATCH] Add before_item_moved event This event gets called just before `util.move` with the same arguments as the `item_moved` event. --- beets/library.py | 2 ++ docs/dev/plugins.rst | 3 +++ 2 files changed, 5 insertions(+) diff --git a/beets/library.py b/beets/library.py index 4bdc321cb..1df2b337e 100644 --- a/beets/library.py +++ b/beets/library.py @@ -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) diff --git a/docs/dev/plugins.rst b/docs/dev/plugins.rst index cda1ca29e..ffb2d0721 100644 --- a/docs/dev/plugins.rst +++ b/docs/dev/plugins.rst @@ -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