How to use the opentimelineio.adapters.read_from_string function in OpenTimelineIO

To help you get started, we’ve selected a few OpenTimelineIO examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PixarAnimationStudios / OpenTimelineIO / tests / test_timeline_algo.py View on Github external
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,
github PixarAnimationStudios / OpenTimelineIO / tests / test_hooks_plugins.py View on Github external
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)
github PixarAnimationStudios / OpenTimelineIO / tests / test_adapter_plugin.py View on Github external
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
        )
github PixarAnimationStudios / OpenTimelineIO / tests / test_cmx_3600_adapter.py View on Github external
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)
github PixarAnimationStudios / OpenTimelineIO / tests / test_hooks_plugins.py View on Github external
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
        )
github PixarAnimationStudios / OpenTimelineIO / tests / test_cmx_3600_adapter.py View on Github external
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'
            )
github PixarAnimationStudios / OpenTimelineIO / contrib / opentimelineio_contrib / adapters / extern_rv.py View on Github external
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)