Skip to content
Permalink
Browse files

#551 AAF Adapter creates ExternalReference for UNC Path (#560)

  • Loading branch information...
JoshBurnell authored and jminor committed Aug 28, 2019
1 parent 0209b17 commit 0c9655c22adb809a00f1b323298dc4e118746226
@@ -298,13 +298,20 @@ def _transcribe(item, parents, editRate, masterMobs):
mastermob = child_mastermob or parent_mastermob or None

if mastermob:
media = otio.schema.MissingReference()
mastermob_child = masterMobs.get(str(mastermob.mob_id))
unc_path = (mastermob_child.metadata.get("AAF", {})
.get("UserComments", {})
.get("UNC Path"))
if unc_path:
media = otio.schema.ExternalReference()
media.target_url = "file://" + unc_path.replace("\\", "/")
else:
media = otio.schema.MissingReference()
media.available_range = otio.opentime.TimeRange(
otio.opentime.RationalTime(media_start, editRate),
otio.opentime.RationalTime(media_length, editRate)
)
# copy the metadata from the master into the media_reference
mastermob_child = masterMobs.get(str(mastermob.mob_id))
media.metadata["AAF"] = mastermob_child.metadata.get("AAF", {})
result.media_reference = media

@@ -832,6 +832,22 @@ def test_multiple_top_level_mobs(self):
self.assertIsInstance(result, otio.schema.SerializableCollection)
self.assertEqual(2, len(result))

def test_external_reference_from_unc_path(self):
timeline = otio.adapters.read_from_file(SIMPLE_EXAMPLE_PATH)
video_track = timeline.video_tracks()[0]
first_clip = video_track[0]
self.assertIsInstance(first_clip.media_reference,
otio.schema.ExternalReference)

unc_path = first_clip.media_reference.metadata.get("AAF", {}) \
.get("UserComments", {}) \
.get("UNC Path")
unc_path = "file://" + unc_path
self.assertEqual(
first_clip.media_reference.target_url,
unc_path
)


class AAFWriterTests(unittest.TestCase):
def test_aaf_writer_gaps(self):

0 comments on commit 0c9655c

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