EDL

EditProcessor

class edl.EditProcessor(shot_regexp=None)[source]

Bases: object

An example of keeping previous parsed edit event around, while using the process edit function.

process(edit, logger)[source]

Example : process the current edit and display previous and current one

EditEvent

class edl.EditEvent(id=None, reel=None, channels=None, source_in=None, source_out=None, record_in=None, record_out=None, fps=24, drop_frame=None)[source]

Bases: object

An entry, or event, or edit from an edit list

New attributes can be added at runtime, provided that they don’t clash with EditEvent regular attributes, by just setting their value, e.g. edit.my_own_attribute = "awesome" They then are accessible like other regular attributes, e.g. print edit.my_own_attribute

This implementation assume timecodes out are exclusive, meaning that a one frame long record would be 00:00:00:01 00:00:00:02 ( not 00:00:00:01 )

Instantiate a new EditEvent

Parameters:
  • id – The edit id in a Edit Decision list, as an int.

  • reel – The reel for this edit as a str.

  • channels – Channels for this edit, video, audio, etc. as a str.

  • source_in – Timecode in for the source, as a string formatted as hh:mm:ss:ff for non-drop frame or hh:mm:ss;ff for drop frame.

  • source_out – Timecode out for the source, as a string formatted as hh:mm:ss:ff for non-drop frame or hh:mm:ss;ff for drop frame.

  • record_in – Timecode in for the recorder, as a string formatted as hh:mm:ss:ff for non-drop frame or hh:mm:ss;ff for drop frame.

  • record_out – Timecode out for the recorder, as a string formatted as hh:mm:ss:ff for non-drop frame or hh:mm:ss;ff for drop frame.

  • fps – Number of frames per second for this edit, as an int or float.

  • drop_frame – Boolean indicating whether this edit uses drop frame or not or None if it’s not specified. Default is None.

property fps

Return the fps for this edit.

Returns:

Frame rate setting used by this EditEvent as an int or float.

property drop_frame

Return the drop frame value for this edit.

Returns:

Boolean indicating if this EditEvent is drop frame or not.

property channels

Return the channels for this edit.

Returns:

String representing the channels in this EditEvent (eg. “AV”, “V”, etc.)

property id

Return the id for this edit.

Returns:

Id of this EditEvent as an int.

property reel

Return the reel for this edit.

Returns:

Reel for this EditEvent as a str.

property comments

Return the comments for this edit, as a list.

Returns:

List of comment strings for this EditEvent.

property pure_comments

An iterator over “pure” comments, that is comments which do not contain known keywords.

Yields:

Iterator for looping over pure (non-keyword) comments.

property timecodes

Return the source in, source out, record in, record out timecodes for this edit as a tuple.

Returns:

Tuple of timecodes for this EditEvent as (source_in, source_out, record_in, record_out).

property source_in

Return the source in timecode for this edit.

Returns:

Timecode string representing the source in for this EditEvent.

property source_out

Return the source out timecode for this edit.

Returns:

Timecode string representing the source out for this EditEvent.

property source_duration

Return the source duration, in frames.

Returns:

Int representing the source duration in frames.

property record_in

Return the record in timecode for this edit.

Returns:

Timecode string representing the record in for this EditEvent.

property record_out

Return the record out timecode for this edit.

Returns:

Timecode string representing the record out for this EditEvent.

property record_duration

Return the record duration, in frames.

Returns:

Int representing the record duration in frames.

property has_effects

Return True if this EditEvent has some effect(s).

Returns:

Boolean indicating whether this EditEvent has effects.

add_effect(tokens)[source]

For now, just register the effect line as a string and append it to the list of effects for this EditEvent.

Later we might want to parse the tokens, and store some actual effects value on this edit.

Parameters:

tokens – List of tokens for the effect.

add_comments(comments)[source]

Associate a comment line to this edit.

Parameters:

comments – Comment string to append to the list of comments for this EditEvent.

property has_retime

Return True if this edit has some retime.

Returns:

Boolean indicating whether this EditEvent has a retime.

add_retime(tokens)[source]

For now, just register the retime line as a string and append it to the list of retimes for this EditEvent.

Later we might want to parse the tokens, and store some actual retime values.

Parameters:

tokens – List of tokens for the retime.

EditList

class edl.EditList(fps=24, file_path=None, visitor=None)[source]

Bases: object

An Edit Decision List.

Typical use of EditList could look like this:

# Define a visitor to extract some extra information from comments or locators.
def edit_parser(edit):
    # New attributes can be added on the fly.
    if edit.id % 2:
        edit.is_even = False
    else:
        edit.is_even = True

edl = EditList(file_path="/tmp/my_edl.edl", visitor=edit_parser)
for edit in edl.edits:
    print str(edit)
    # Added attributes are reachable like regular ones.
    print edit.is_even

Instantiate a new Edit Decision List.

Parameters:
  • fps – Number of frames per second for this EditList as an int or float.

  • file_path – Full path to a file to read.

  • visitor – A callable which will be called on every edit and should accept as input an EditEvent and a logger.

classmethod set_logger(logger)[source]

Allow to use another logger than the default one provided in this framework.

property has_transitions

Return True if this EditList contains events with transitions.

Returns:

Boolean indicating if this EditList contains events with transitions.

property drop_frame

Return True if this EditList is drop frame.

Returns:

Boolean indicating if this EditList uses drop frame or not.

property edits

Return a list of all edit events in this EditList.

Returns:

List of edit event objects in this edit list.

property title

Return this EditList’s title

Returns:

Title of this edit list as a str.

property fps

Return the number of frame per seconds used by this EditList.

Returns:

Frame rate setting used by this edit list as an int or float.

read_cmx_edl(path, fps=24, visitor=None)[source]

Parse the given edl file, extract a list of versions that need to be created.

Parameters:
  • path – Full path to a cmx compatible file to read.

  • fps – Number of frames per-second for this EditList as an int or float.

  • visitor – A callable which will be called on every edit and should accept as input an EditEvent and a logger.

Functions

edl.process_edit(edit, logger, shot_regexp=None)[source]

Extract standard meta data from comments for an Edit:

  • name from * LOC: 01:00:00:12 YELLOW  MR0200

  • clip name from * FROM CLIP NAME:  246AA-6

  • tape from * SOURCE FILE: LR9907610

  • asc_sop and asc_sat from:

    ASC_SOP (1.0854 1.0451 0.9943)(0.0009 0.0022 -0.0292)(1.0163 1.0105 0.9424)
    ASC_SAT 1.0000
    

If a regular expression is given, it will be used to extract extra information from the edit name.

  • a shot name

  • a type

  • a format

Typical values for the regular expression would be as simple as a single group to extract the shot name, e.g. ^(\w+)_.+$ or more advanced regular expression with named groups to extract additional information, e.g. (?P<shot_name>\w+)_(?P<type>\w\w\d\d)_(?P<version>[V,v]\d+)$

Parameters:
  • edit – An Edit instance.

  • logger – A standard logger.

  • shot_regexp – A regular expression to extract extra information from the edit name.