Merge pull request #12 from iluvcapra/feat-adobe

Added support for Adobe Premiere EDLs > 999 events
This commit is contained in:
Jamie Hardt
2025-01-07 11:49:54 -08:00
committed by GitHub
3 changed files with 17 additions and 5 deletions

View File

@@ -5,12 +5,13 @@
# pycmx # pycmx
The `pycmx` package provides a basic interface for parsing a CMX 3600 EDL and its most most common variations. The `pycmx` package provides a basic interface for parsing a CMX 3600 EDL and
its most most common variations.
## Features ## Features
* The major variations of the CMX 3600: the standard, "File32" and "File128" * The major variations of the CMX 3600: the standard, "File32", "File128" and
formats are automatically detected and properly read. long Adobe Premiere formats are automatically detected and properly read.
* Preserves relationship between events and individual edits/clips. * Preserves relationship between events and individual edits/clips.
* Remark or comment fields with common recognized forms are read and * Remark or comment fields with common recognized forms are read and
available to the client, including clip name and source file data. available to the client, including clip name and source file data.
@@ -83,5 +84,3 @@ Audio channel 7 is present
>>> events[2].edits[0].channels.video >>> events[2].edits[0].channels.video
False False
``` ```

View File

@@ -60,6 +60,7 @@ def _parse_cmx3600_line(line: str, line_number: int) -> object:
""" """
long_event_num_p = re.compile("^[0-9]{6} ") long_event_num_p = re.compile("^[0-9]{6} ")
short_event_num_p = re.compile("^[0-9]{3} ") short_event_num_p = re.compile("^[0-9]{3} ")
x_event_form_p = re.compile("^([0-9]{4,5}) ")
if line.startswith("TITLE:"): if line.startswith("TITLE:"):
return _parse_title(line, line_number) return _parse_title(line, line_number)
@@ -71,6 +72,11 @@ def _parse_cmx3600_line(line: str, line_number: int) -> object:
return _parse_long_standard_form(line, 32, line_number) return _parse_long_standard_form(line, 32, line_number)
else: else:
return _parse_long_standard_form(line, 128, line_number) return _parse_long_standard_form(line, 128, line_number)
elif (m := x_event_form_p.match(line)) is not None:
assert m is not None
event_field_length = len(m[1])
return _parse_columns_for_standard_form(line, event_field_length,
8, line_number)
elif short_event_num_p.match(line) is not None: elif short_event_num_p.match(line) is not None:
return _parse_standard_form(line, line_number) return _parse_standard_form(line, line_number)
elif line.startswith("AUD"): elif line.startswith("AUD"):

View File

@@ -113,3 +113,10 @@ class TestParse(TestCase):
events = list(edl.events) events = list(edl.events)
self.assertEqual( self.assertEqual(
events[4].edits[1].transition.name, "CROSS DISSOLVE") events[4].edits[1].transition.name, "CROSS DISSOLVE")
def test_adobe_wide(self):
with open("tests/edls/adobe_dai109_test.txt", 'r',
encoding='ISO-8859-1') as f:
edl = pycmx.parse_cmx3600(f)
events = list(edl.events)
self.assertEqual(len(events), 2839)