Skip to content
Permalink
Browse files

FCP XML: Adds a check on the NTSC element before reading its value (#524

)

Some softwares don't add the <NTSC> element if the framerate
is not NTSC. Check if the element can be found before trying to
check it's value.
  • Loading branch information...
BadSingleton authored and ssteinbach committed Aug 22, 2019
1 parent 36f85f7 commit 689d3c481c84402688f1a20b037990e03126e139
Showing with 14 additions and 1 deletion.
  1. +2 −1 src/py-opentimelineio/opentimelineio/adapters/fcp_xml.py
  2. +12 −0 tests/test_fcp7_xml_adapter.py
@@ -205,7 +205,8 @@ def _rate_for_element(element):
"""
# rate is encoded as a timebase (int) which can be drop-frame
base = float(element.find("./timebase").text)
if _bool_value(element.find("./ntsc")):
ntsc = element.find("./ntsc")
if ntsc is not None and _bool_value(ntsc):
base *= 1000.0 / 1001

return base
@@ -225,6 +225,18 @@ def test_rate_for_element_ntsc_conversion_30(self):

self.assertEqual(rate, 30)

def test_rate_for_element_no_ntsc(self):
rate_element = cElementTree.fromstring(
"""
<rate>
<timebase>30</timebase>
</rate>
"""
)
rate = self.adapter._rate_for_element(rate_element)

self.assertEqual(rate, 30)

def test_rate_from_context(self):
sequence_elem = cElementTree.fromstring(
"""

0 comments on commit 689d3c4

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