def test_EffectMatcher_apply_is_working_properly(self): """testing if the EffectMatcher.apply() is working properly """ ed_list = List('24') event = Event({}) event.transition = Effect() ed_list.append(event) e = EffectMatcher() test_line = 'EFFECTS NAME IS Constant Power' e.apply(ed_list, test_line) self.assertEqual( 'Constant Power', event.transition.effect ) test_line = 'EFFECTS NAME IS CROSS DISSOLVE' e.apply(ed_list, test_line) self.assertEqual( 'CROSS DISSOLVE', event.transition.effect )
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.rate.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.rate.timebase, frames=clip.in_ + 1) # 1 frame after last frame shown src_end_tc = Timecode(self.rate.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.rate.timebase, frames=clip.start + 1) # 1 frame after last frame shown rec_end_tc = Timecode(self.rate.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://localhost', '') if ':' in source_file and source_file.startswith('/'): # remove the leading '/' source_file = source_file[1:] 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