Skip to content
Permalink
Browse files

Rodeofx fix cmx 3600 multiple markers per clip issue 593 (#664)

* Support multiple markers per clip for cmx_3600 adapter (issue-593)

* Remove unnecessary indentation, adjust test for multiple markers

* Adjust no_spaces_test.edl to match the changes made to screening_example.edl

Co-authored-by: Emile Labrosse <elabrosse@rodeofx.com>
  • Loading branch information
reinecke and elabrosseRodeofx committed Mar 17, 2020
1 parent 94597bf commit 15c29b5a0baa50cae6ab5dc18aa40ac0fc8485e6
@@ -450,7 +450,7 @@ def make_clip(self, comment_data):
}
}

if 'locator' in comment_data:
if 'locators' in comment_data:
# An example EDL locator line looks like this:
# * LOC: 01:00:01:14 RED ANIM FIX NEEDED
# We get the part after "LOC: " as the comment_data entry
@@ -459,11 +459,15 @@ def make_clip(self, comment_data):
# variations of EDL, so if we are lenient then maybe we
# can handle more of them? Only real-world testing will
# determine this for sure...
m = re.match(
r'(\d\d:\d\d:\d\d:\d\d)\s+(\w*)(\s+|$)(.*)',
comment_data["locator"]
)
if m:
for locator in comment_data['locators']:
m = re.match(
r'(\d\d:\d\d:\d\d:\d\d)\s+(\w*)(\s+|$)(.*)',
locator
)
if not m:
# TODO: Should we report this as a warning somehow?
continue

marker = schema.Marker()
marker.marked_range = opentime.TimeRange(
start_time=opentime.from_timecode(
@@ -477,7 +481,6 @@ def make_clip(self, comment_data):
# is not a valid enum somehow.
color_parsed_from_file = m.group(2)

marker.metadata.clear()
marker.metadata.update({
"cmx_3600": {
"color": color_parsed_from_file
@@ -495,9 +498,6 @@ def make_clip(self, comment_data):

marker.name = m.group(4)
clip.markers.append(marker)
else:
# TODO: Should we report this as a warning somehow?
pass

clip.source_range = opentime.range_from_start_end_time(
opentime.from_timecode(self.source_tc_in, self.edl_rate),
@@ -580,7 +580,7 @@ class CommentHandler(object):
('FROM CLIP NAME', 'clip_name'),
('FROM CLIP', 'media_reference'),
('FROM FILE', 'media_reference'),
('LOC', 'locator'),
('LOC', 'locators'),
('ASC_SOP', 'asc_sop'),
('ASC_SAT', 'asc_sat'),
('M2', 'motion_effect'),
@@ -598,9 +598,18 @@ def parse(self, comment):
regex = self.regex_template.format(id=comment_id)
match = re.match(regex, comment)
if match:
self.handled[comment_type] = match.group(
'comment_body'
).strip()
comment_body = match.group('comment_body').strip()

# Special case for locators. There can be multiple locators per clip.
if comment_type == 'locators':
try:
self.handled[comment_type].append(comment_body)
except KeyError:
self.handled[comment_type] = [comment_body]

else:
self.handled[comment_type] = comment_body

break
else:
stripped = comment.lstrip('*').strip()
@@ -11,7 +11,8 @@ FCM: NON-DROP FRAME
*SOURCE FILE: ZZ100_503A.LAY1.01
004 ZZ100_50 V C 01:00:10:01 01:00:14:20 00:59:58:00 01:00:02:19
*FROM CLIP NAME: ZZ100_504C (LAY1)
*LOC: 01:00:01:14 RED ANIM FIX NEEDED
*LOC: 01:00:01:14 RED ANIM FIX NEEDED
*LOC: 01:00:02:14 PINK ANIM FIX NEEDED
*SOURCE FILE: ZZ100_504C.LAY1.02
005 ZZ100_50 V C 01:00:14:17 01:00:18:22 01:00:02:19 01:00:07:00
*FROM CLIP NAME: ZZ100_504B (LAY1)
@@ -14,7 +14,8 @@ FCM: NON-DROP FRAME
* SOURCE FILE: ZZ100_503A.LAY1.01
004 ZZ100_50 V C 01:00:10:01 01:00:14:20 00:59:58:00 01:00:02:19
* FROM CLIP NAME: ZZ100_504C (LAY1)
* LOC: 01:00:01:14 RED ANIM FIX NEEDED
* LOC: 01:00:01:14 RED ANIM FIX NEEDED
* LOC: 01:00:02:14 PINK ANIM FIX NEEDED
* SOURCE FILE: ZZ100_504C.LAY1.02
005 ZZ100_50 V C 01:00:14:17 01:00:18:22 01:00:02:19 01:00:07:00
* FROM CLIP NAME: ZZ100_504B (LAY1)
@@ -94,7 +94,7 @@ def test_edl_read(self):
otio.opentime.from_timecode("00:00:04:19", fps)
)

self.assertEqual(len(timeline.tracks[0][3].markers), 1)
self.assertEqual(len(timeline.tracks[0][3].markers), 2)
marker = timeline.tracks[0][3].markers[0]
self.assertEqual(marker.name, "ANIM FIX NEEDED")
self.assertEqual(marker.metadata.get("cmx_3600").get("color"), "RED")

0 comments on commit 15c29b5

Please sign in to comment.
You can’t perform that action at this time.