Expand description
Adding items, a folder, a smart folder or a tag group of the open library to another library (Eagle’s “Add to Other Library”).
What Eagle does, which falcon follows:
- items: each
images/<id>.infofolder is copied whole into the other library. One whose id the other library already has is left alone (and counted as already there). The copy’smetadata.jsonloses itsfolders(they belong to this library), and itsmodificationTimebecomes now plus the item’s position, so the items show up as newly added in their order. - a folder: the folder (with its subfolders, ids kept) is put at the top
of the other library’s tree unless that library already has its id;
subfolders whose ids it already has are not added a second time. Its
items and its subfolders’ items are copied as above but keep their
folders, and in a folder sorted by hand they also keep theirmodificationTime. - a smart folder or a tag group: only the definition is added, at the top of the list, under new ids (a smart folder’s subfolders too).
falcon differs in three small ways: an item copied with a folder keeps
only the folder ids the other library has once the tree is merged (so no
item points at a folder that isn’t there); a new folder’s descendants
whose ids exist elsewhere in the other library are merged into those, as
in crate::library_merge; and each item folder is copied under a
temporary name, its metadata rewritten there, then renamed into place, so
the other library never sees half an item. Eagle leaves the other
library’s tags.json alone, and so does falcon.
The copy (copy_items) needs no lock on either library and runs on a
background thread; Library::finish_add then merges the definitions
into the other library and registers the copied items there. The caller
checks the other library with check_target first.
Structs§
- AddPlan
- Everything one Add to Other Library copies.
- AddReport
- What a finished Add to Other Library added.
- Copied
- How the item copies went.
Enums§
- AddRefusal
- Why the other library can’t take the items.
- Extra
- What is added besides the items.
Functions§
- check_
target - Checks that
targetis another library falcon may write: notcurrent, holdingmetadata.jsonandimages/, and not made by a newer Eagle. - copy_
items - Copies the plan’s item folders into the other library’s
images/, rewriting each copy’smetadata.jsonas Eagle does before it is renamed into place. Callsprogress(done, total)after each item and stops early whencancelis set (what was copied stays). Needs no library lock.