| 1 |
ImportAdded Plugin |
| 2 |
================== |
| 3 |
|
| 4 |
The ``importadded`` plugin is useful when an existing collection is imported and |
| 5 |
the time when albums and items were added should be preserved. |
| 6 |
|
| 7 |
To use the ``importadded`` plugin, enable it in your configuration (see |
| 8 |
:ref:`using-plugins`). |
| 9 |
|
| 10 |
Usage |
| 11 |
----- |
| 12 |
|
| 13 |
The :abbr:`mtime (modification time)` of files that are imported into the |
| 14 |
library are assumed to represent the time when the items were originally added. |
| 15 |
|
| 16 |
The ``item.added`` field is populated as follows: |
| 17 |
|
| 18 |
- For singleton items with no album, ``item.added`` is set to the item's file |
| 19 |
mtime before it was imported. |
| 20 |
- For items that are part of an album, ``album.added`` and ``item.added`` are |
| 21 |
set to the oldest mtime of the files in the album before they were imported. |
| 22 |
The mtime of album directories is ignored. |
| 23 |
|
| 24 |
This plugin can optionally be configured to also preserve mtimes at import using |
| 25 |
the ``preserve_mtimes`` option. |
| 26 |
|
| 27 |
When ``preserve_write_mtimes`` option is set, this plugin preserves mtimes after |
| 28 |
each write to files using the ``item.added`` attribute. |
| 29 |
|
| 30 |
File modification times are preserved as follows: |
| 31 |
|
| 32 |
- For all items: |
| 33 |
|
| 34 |
- ``item.mtime`` is set to the mtime of the file from which the item is |
| 35 |
imported from. |
| 36 |
- The mtime of the file ``item.path`` is set to ``item.mtime``. |
| 37 |
|
| 38 |
Note that there is no ``album.mtime`` field in the database and that the mtime |
| 39 |
of album directories on disk aren't preserved. |
| 40 |
|
| 41 |
Configuration |
| 42 |
------------- |
| 43 |
|
| 44 |
To configure the plugin, make an ``importadded:`` section in your configuration |
| 45 |
file. There are two options available: |
| 46 |
|
| 47 |
- **preserve_mtimes**: After importing files, re-set their mtimes to their |
| 48 |
original value. Default: ``no``. |
| 49 |
- **preserve_write_mtimes**: After writing files, re-set their mtimes to their |
| 50 |
original value. Default: ``no``. |
| 51 |
|
| 52 |
Reimport |
| 53 |
-------- |
| 54 |
|
| 55 |
This plugin will skip reimported singleton items and reimported albums and all |
| 56 |
of their items. |