def write_to_file(input_otio, filepath, **kwargs): with aaf2.open(filepath, "w") as f: timeline = aaf_writer._stackify_nested_groups(input_otio) aaf_writer.validate_metadata(timeline) otio2aaf = aaf_writer.AAFFileTranscriber(timeline, f, **kwargs) if not isinstance(timeline, otio.schema.Timeline): raise otio.exceptions.NotSupportedError( "Currently only supporting top level Timeline") for otio_track in timeline.tracks: # Ensure track must have clip to get the edit_rate if len(otio_track) == 0: continue transcriber = otio2aaf.track_transcriber(otio_track) for otio_child in otio_track: result = transcriber.transcribe(otio_child) if result: transcriber.sequence.components.append(result)
def write_to_file(input_otio, filepath): with aaf2.open(filepath, "w") as f: aaf_writer.validate_metadata(input_otio) otio2aaf = aaf_writer.AAFFileTranscriber(input_otio, f) if not isinstance(input_otio, otio.schema.Timeline): raise otio.exceptions.NotSupportedError( "Currently only supporting top level Timeline") for otio_track in input_otio.tracks: # Ensure track must have clip to get the edit_rate if len(otio_track) == 0: continue transcriber = otio2aaf.track_transcriber(otio_track) for otio_child in otio_track: if isinstance(otio_child, otio.schema.Gap): filler = transcriber.aaf_filler(otio_child) transcriber.sequence.components.append(filler) elif isinstance(otio_child, otio.schema.Transition): transition = transcriber.aaf_transition(otio_child) if transition: transcriber.sequence.components.append(transition) elif isinstance(otio_child, otio.schema.Clip): source_clip = transcriber.aaf_sourceclip(otio_child) transcriber.sequence.components.append(source_clip) elif isinstance(otio_child, otio.schema.Stack): raise otio.exceptions.NotSupportedError( "Currently not supporting " "nesting") else: raise otio.exceptions.NotSupportedError( "Unsupported otio child " "type: {}".format(type(otio_child)))