diff --git a/beets/library.py b/beets/library.py index 2295861fe..49ba4a9ca 100644 --- a/beets/library.py +++ b/beets/library.py @@ -392,6 +392,7 @@ class Item(LibModel): # The file has a new mtime. self.mtime = self.current_mtime() + plugins.send('after_write', item=self) # Files themselves. diff --git a/docs/changelog.rst b/docs/changelog.rst index 28cdb4cf8..1b6321484 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -25,6 +25,7 @@ New stuff: * :doc:`/plugins/echonest`: Echo Nest similarity now weights the tempo in better proportion to other metrics. Also, options were added to specify custom thresholds and output formats. Thanks to Adam M. +* Added the :ref:`after_write ` plugin event. Fixes: diff --git a/docs/dev/plugins.rst b/docs/dev/plugins.rst index c67abc21f..1791adf6d 100644 --- a/docs/dev/plugins.rst +++ b/docs/dev/plugins.rst @@ -90,6 +90,8 @@ You can add command-line options to your new command using the ``parser`` member of the ``Subcommand`` class, which is an ``OptionParser`` instance. Just use it like you would a normal ``OptionParser`` in an independent script. +.. _plugin_events: + Listen for Events ^^^^^^^^^^^^^^^^^ @@ -141,6 +143,9 @@ currently available are: * *write*: called with an ``Item`` object just before a file's metadata is written to disk (i.e., just before the file on disk is opened). +* *after_write*: called with an ``Item`` object after a file's metadata is + written to disk (i.e., just after the file on disk is closed). + * *import_task_start*: called when before an import task begins processing. Parameters: ``task`` (an `ImportTask`) and ``session`` (an `ImportSession`).