Expand description
Export to Computer: copying originals out of the library into a folder the user picked.
A Plan is worked out first (where each original goes, which
directories to make), so the app can warn about files it would replace
before anything is written, and run the copy on another thread. Names
follow Eagle’s export: an item keeps <name>.<ext>; names that clash
within one directory (ignoring case, as the Mac’s file system does) are
numbered <name>-1.<ext>, <name>-2.<ext>, with the number padded to
the width of the largest one.
Structs§
Enums§
- Collision
- What to do when a file of the same name is already in the destination.
- Format
- An image format to export to.
Constants§
- CSV_
HEADER - The CSV columns, in Eagle’s order: id, name, extension, width, height, duration, source URL, notes, comments, tags, folders, size, rating, import time, modification time and the original’s path. The header text is falcon’s own.
Functions§
- convert_
bytes - Decodes an original (SVG rendered at its natural size), scales it down
to
longestif needed, and encodes it asconvertasks. - convertible
- Whether an item’s original can be converted: raster images falcon decodes, and SVG.
- copy_
file - Copies one original, keeping its modification time, as Eagle does. The copy is written beside its destination and renamed into place, so a failed copy never leaves half a file under the real name.
- csv
- The CSV text for
ids(unknown ids skipped): a header and one row per item, lines joined with\n, preceded by a UTF-8 byte order mark so spreadsheet apps read it as UTF-8, as Eagle writes it. - csv_
field - One CSV field: quoted, with quotes doubled, when it holds a comma, a quote or a line break; as it is otherwise.
- csv_row
- The CSV row for one item.
- data_
url - Copy Base64: a
data:URL of the item’s original when it is a JPEG, PNG, WebP or GIF, else of its thumbnail (whose real format is sniffed: Eagle’s thumbnails are WebP inside a.pngname).Nonewhen there is neither. - file_
name - An item’s file name,
<name>.<ext>, with any/(which no file name can hold) turned into a space. - folder_
dir_ name - The directory name for a folder, cleaned up as Eagle does on the Mac:
tabs and runs of spaces become one space,
:/and\\become spaces, the ends are trimmed and a trailing dot is dropped. A name left empty becomes “Untitled”. - folder_
paths_ text - Lines for Copy Folder Path: each item’s
<id>.infofolder with a trailing slash, as Eagle copies them. - name_
files - Chooses the names for
filescopied into one directory that already holdsexisting(lower-cased). Names are compared ignoring case. A name used once, and free, is kept. Otherwise every file of that name is numbered, as Eagle does:a.pngtwice becomesa-1.pnganda-2.png; withKeepBoth, ana.pngalready there counts as the first, so a new one becomesa-2.png. A numbered name that is taken is skipped. - paths_
text - Lines for Copy File Path: each item’s original, one per line, as Eagle copies them.
- plan_
converted - Plans exporting
idsconverted toformatintodest: each file is named<name>.<format ext>, clashes handled as inplan_items. Items that can’t be converted are left out; seeconvertible. - plan_
folder - Plans exporting the folder
idas a directory tree underdest: a directory per folder and subfolder, each holding the originals of the live items filed directly in it (an item in two folders is copied into both). Items in any folder ofhidden(locked ones) are left out, as are hidden subfolders. Sibling folders whose names clean up to the same directory share it.Noneif there is no such folder. - plan_
items - Plans copying the originals of
ids(in order, each once) straight intodest. Unknown ids are skipped. - plan_
smart - Plans exporting the smart folder
idas one flat directory underdestholding the originals of its items (Eagle exports a smart folder without its subfolders). Items inhiddenfolders are left out.Noneif there is no such smart folder. - run
- Runs
plan, callingon_stepafter each copy with whether it worked, and returns the paths written. A step that fails is skipped; the rest still run. Oncecancelis set the run stops before the next file; the files already written stay (each is written whole or not at all). - run_
converted - Runs a
plan_convertedplan: each step’s original is converted and written beside its destination, then renamed into place.cancelstops it between files, as inrun. - thumbnail_
image - Copy Thumbnail: the item’s thumbnail decoded, or, for an item without one, its original if that is an image.
- write_
csv - Writes
csvtodest(through a temporary file) and returns the number of rows.