mirror of
https://github.com/beetbox/beets.git
synced 2026-01-01 05:23:05 +01:00
Merge pull request #600 from geigerzaehler/after-write-hook
Add after_write plugin event
This commit is contained in:
commit
4a5a203907
3 changed files with 7 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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_events>` plugin event.
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -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`).
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue