Module import

Source
Expand description

Import timelines from other editors, with an honest per-item report.

Supported: Final Cut Pro 7 XML (.xml - what Premiere Pro exports and DaVinci Resolve reads/writes), EDL (CMX 3600) and uncompressed Premiere .prproj (the same XML reader). A real .prproj is gzip-wrapped and there is no inflate in-tree, so those are accepted by the picker only to answer with the β€œexport FCP7 XML instead” note below. Anything the reader cannot map (unknown effects, missing media, speed ramps, colour pages) becomes an Issue instead of failing the import.

StructsΒ§

Build πŸ”’
El πŸ”’
Event πŸ”’
ImportReport
Issue
Probed
One finished probe, ready for adopt.

EnumsΒ§

Level

ConstantsΒ§

IMPORT_EXTS
MAX_XML_DEPTH πŸ”’
Maximum element nesting. El drops recursively and find_all recurses, so an adversarial file of 100k nested tags would overflow the (UI-thread) stack β€” which no catch_unwind can catch. Real FCP7/EDL exports are under 20 deep.

StaticsΒ§

PROBING πŸ”’
Paths with a probe still out. By path rather than asset id: a probe outlives the project that started it, and paths are what the library has to hand. ponytail: linear scan under one lock β€” an import batch is a handful of files, not a thousand.

FunctionsΒ§

adopt
Fold a finished probe into project. The asset is seconds old, so every clip on it was placed against the placeholder (one MIN_CLIP-long clip, wrong audio streams): those are laid down again at the same starts now that the real duration is known. False when the asset is already gone.
asset_of πŸ”’
Asset for a <file>: defined once, then referenced by id (<file id="file-3"/>).
attach πŸ”’
cell πŸ”’
A markdown table cell: no pipes, no line breaks.
channels πŸ”’
("V", "A", "A2", "AA", "B", "AA/V") β†’ (has video, audio track indices).
close πŸ”’
Close name, unwinding any elements left open inside it.
decode πŸ”’
Bytes β†’ text: strips a UTF-8 BOM, decodes UTF-16 (LE/BE BOM) and never fails.
from_pathurl πŸ”’
file://localhost/C:/a%20b/v.mp4 β†’ C:\a b\v.mp4; file://nas/share/v.mp4 β†’ \\nas\share\v.mp4.
import_file
Detect the format by extension + content and import it.
is_probing
Is this asset still waiting for its metadata? (the library says β€œLoading…” instead of a duration)
link_stacks πŸ”’
Clips of one asset at the same place on different tracks are one linked group (video + its audio), which is how Project::insert_asset_clips builds them.
looks_like_edl πŸ”’
ms πŸ”’
parse_event πŸ”’
001 AX V C 00:00:00:00 00:00:02:00 00:00:00:00 00:00:02:00 (a D/W adds a frame count).
parse_tag πŸ”’
parse_xml πŸ”’
Minimal well-formed-ish XML reader: elements, attributes, text, CDATA; comments / PIs / DOCTYPE are skipped. Mismatched or missing close tags unwind instead of failing β€” exported timelines are machine written, but a truncated one should still give back what it has. Nesting is capped at MAX_XML_DEPTH.
percent_decode πŸ”’
place πŸ”’
Put the clip on ti, or on the first track of the same kind with room (a new one if needed).
placeholder
Stand-in asset for a file whose probe has not come back: the name and a kind guessed from the extension are all we know. An audio placeholder claims one stream so that dropping a song on the timeline before the probe lands still makes a clip for adopt to rebuild.
probe_async
Probe files (placeholder asset id + path) on a worker. Returns at once; poll the receiver.
rate_of πŸ”’
read_clipitem πŸ”’
read_edl πŸ”’
read_filters πŸ”’
Opacity / Basic Motion become clip properties; everything else is reported.
read_transitionitem πŸ”’
read_xmeml πŸ”’
relink πŸ”’
Look for the file next to the imported timeline, then one level of sub-folders.
source_name πŸ”’
tag_end πŸ”’
Index of the > closing a tag, ignoring quoted attribute values.
timecode πŸ”’
HH:MM:SS:FF (; = drop frame) β†’ seconds.
track_slot πŸ”’
Ensure the n-th track of kind exists and return its index.
transition_kind πŸ”’
unescape πŸ”’
utf16 πŸ”’