Skip to main content

Module autotag

Module autotag 

Source
Expand description

Folder auto-tags: the tags stored in a folder’s tags key, which Eagle adds to every item put into the folder.

Eagle works out, for each folder, the folder’s own tags followed by its parent’s, its grandparent’s and so on up to the top; it keeps the first copy of each tag and then reverses the whole list. That list (the runtime extendTags, which Eagle strips before writing metadata.json) is what gets applied, so a subfolder’s items also get every ancestor’s auto-tags. The cached extendTags key, when a file has one, is ignored here: the list is always worked out from tags.

How the list is applied depends on the way the item arrives: importing (or pasting) into a folder appends the tags the item lacks; adding to a folder appends them only when the item was not already in it; dropping onto a folder appends them either way. Tags are never removed and never reordered.

Functions§

append_new
Appends the tags in add that tags lacks, in order. Returns whether any were added.
auto_tags_for
The auto-tags for an item going into several folders at once: each folder’s list in the order given, first copy of each tag kept.
folder_auto_tags
The tags Eagle applies to an item put into folder id: the folder’s own tags, then each ancestor’s in turn up to the top level, with only the first copy of each kept, and the result reversed. Empty for an unknown folder.
join_folder
Adds item to folder id as Eagle’s add-to-folder does: when the item is not in the folder yet it joins it, comes out of the Trash and gets the folder’s auto-tags. Returns false, with the item untouched, when it was already in the folder.