def to_edl(self): """Returns an edl.List instance equivalent of this Sequence instance """ from edl import List, Event from timecode import Timecode l = List(self.timebase) l.title = self.name # convert clips to events if not self.media: raise RuntimeError( 'Can not run %(class)s.to_edl() without a Media instance, ' 'please add a Media instance to this %(class)s instance.' % { 'class': self.__class__.__name__ } ) video = self.media.video if video is not None: i = 0 for track in video.tracks: for clip in track.clips: i += 1 e = Event({}) e.num = '%06i' % i e.clip_name = clip.id e.reel = clip.name e.track = 'V' if clip.type == 'Video' else 'A' e.tr_code = 'C' # TODO: for now use C (Cut) later on # expand it to add other transition codes src_start_tc = Timecode(self.timebase, frames=clip.in_ + 1) # 1 frame after last frame shown src_end_tc = Timecode(self.timebase, frames=clip.out + 1) e.src_start_tc = str(src_start_tc) e.src_end_tc = str(src_end_tc) rec_start_tc = Timecode(self.timebase, frames=clip.start + 1) # 1 frame after last frame shown rec_end_tc = Timecode(self.timebase, frames=clip.end + 1) e.rec_start_tc = str(rec_start_tc) e.rec_end_tc = str(rec_end_tc) source_file = clip.file.pathurl.replace('file://', '') e.source_file = source_file e.comments.extend([ '* FROM CLIP NAME: %s' % clip.name, '* SOURCE FILE: %s' % source_file ]) l.append(e) return l
def to_edl(self): """Returns an edl.List instance equivalent of this Sequence instance """ from edl import List, Event from timecode import Timecode l = List(self.timebase) l.title = self.name # convert clips to events if not self.media: raise RuntimeError( 'Can not run %(class)s.to_edl() without a Media instance, ' 'please add a Media instance to this %(class)s instance.' % {'class': self.__class__.__name__}) video = self.media.video if video is not None: i = 0 for track in video.tracks: for clip in track.clips: i += 1 e = Event({}) e.num = '%06i' % i e.clip_name = clip.id e.reel = clip.name e.track = 'V' if clip.type == 'Video' else 'A' e.tr_code = 'C' # TODO: for now use C (Cut) later on # expand it to add other transition codes src_start_tc = Timecode(self.timebase, frames=clip.in_ + 1) # 1 frame after last frame shown src_end_tc = Timecode(self.timebase, frames=clip.out + 1) e.src_start_tc = str(src_start_tc) e.src_end_tc = str(src_end_tc) rec_start_tc = Timecode(self.timebase, frames=clip.start + 1) # 1 frame after last frame shown rec_end_tc = Timecode(self.timebase, frames=clip.end + 1) e.rec_start_tc = str(rec_start_tc) e.rec_end_tc = str(rec_end_tc) source_file = clip.file.pathurl.replace('file://', '') e.source_file = source_file e.comments.extend([ '* FROM CLIP NAME: %s' % clip.name, '* SOURCE FILE: %s' % source_file ]) l.append(e) return l