Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_sample_timeline(self):
result = otio.adapters.read_from_string(
"""
{
"OTIO_SCHEMA": "Timeline.1",
"metadata": {},
"name": null,
"tracks": {
"OTIO_SCHEMA": "Stack.1",
"children": [
{
"OTIO_SCHEMA": "Track.1",
"children": [
{
"OTIO_SCHEMA": "Clip.1",
"effects": [],
"markers": [],
"media_reference": null,
def test_run_hook_through_adapters(self):
result = otio.adapters.read_from_string('foo', adapter_name='example',
media_linker_name='example',
hook_function_argument_map=TEST_METADATA
)
self.assertEqual(result.name, POST_RUN_NAME)
self.assertEqual(result.metadata.get("extra_data"), True)
def setUp(self):
self.jsn = baseline_reader.json_baseline_as_string(ADAPTER_PATH)
self.adp = otio.adapters.read_from_string(self.jsn, 'otio_json')
self.adp._json_path = os.path.join(
baseline_reader.MODPATH,
"baselines",
ADAPTER_PATH
)
def test_can_read_frame_cut_points(self):
# EXERCISE
tl = otio.adapters.read_from_string(
'1 CLPA V C 113 170 0 57\n'
'2 CLPA V C 170 170 57 57\n'
'2 CLPB V D 027 162 189 57 84\n'
'3 CLPB V C 189 381 84 276\n',
adapter_name="cmx_3600"
)
# VALIDATE
self.assertEqual(tl.duration().value, 276)
self.assertEqual(len(tl.tracks[0]), 3)
self.assertEqual(tl.tracks[0][0].duration().value, 70)
self.assertEqual(tl.tracks[0][1].in_offset.value, 13)
self.assertEqual(tl.tracks[0][1].out_offset.value, 14)
self.assertEqual(tl.tracks[0][2].duration().value, 206)
def setUp(self):
self.jsn = baseline_reader.json_baseline_as_string(HOOKSCRIPT_PATH)
self.hook_script = otio.adapters.read_from_string(
self.jsn,
'otio_json'
)
self.hook_script._json_path = os.path.join(
baseline_reader.MODPATH,
"baselines",
HOOKSCRIPT_PATH
)
def test_invalid_edl_style_raises_exception(self):
tl = otio.adapters.read_from_string(
'001 AX V C '
'00:00:00:00 00:00:00:05 00:00:00:00 00:00:00:05\n',
adapter_name="cmx_3600"
)
with self.assertRaises(otio.exceptions.NotSupportedError):
otio.adapters.write_to_string(
tl,
adapter_name='cmx_3600',
style='bogus'
)
def main():
""" entry point, should be called from the rv adapter in otio """
session_file = rvSession.Session()
output_fname = sys.argv[1]
# read the input OTIO off stdin
input_otio = otio.adapters.read_from_string(sys.stdin.read(), 'otio_json')
result = write_otio(input_otio, session_file)
session_file.setViewNode(result)
session_file.write(output_fname)