def from_edl(self, path): """Parses EDL file and returns a Sequence instance which reflects the whole time line hierarchy. :param path: The path of the XML file :return: :class:`.Sequence` """ if not isinstance(path, str): raise TypeError( 'path argument in %s.from_edl should be a string, not %s' % (self.__class__.__name__, path.__class__.__name__) ) from anima.env.mayaEnv import Maya m = Maya() fps = m.get_fps() import edl p = edl.Parser(str(fps)) with open(path) as f: l = p.parse(f) seq = Sequence() seq.from_edl(l) self.from_seq(seq)
def test_24fps(self): p = edl.Parser('24') with open('test-edls/test_24.edl') as f: s = p.parse(f) self.assertEqual(s.events[0].clip_name, 'clip 1', 'Failed clip name test') self.assertEqual(s.events[0].src_length(), 1440, 'Wrong source frame length') self.assertEqual(s.events[0].rec_length(), 1440, 'Wrong record frame length') self.assertEqual(s.events[0].src_start_tc.frames, 86400, 'Wrong source start timecode') self.assertEqual(s.events[0].src_end_tc.frames, 87840, 'Wrong source end timecode') self.assertEqual(s.events[0].rec_start_tc.frames, 0, 'Wrong record start timecode') self.assertEqual(s.events[0].rec_end_tc.frames, 1440, 'Wrong record end timecode') self.assertEqual(s.events[1].clip_name, 'clip #2', 'Failed clip name test char 2') self.assertEqual(s.events[2].clip_name, 'clip -3', 'Failed clip name test char 3') self.assertEqual(s.events[3].clip_name, 'clip $4', 'Failed clip name test char 4') self.assertEqual(s.events[4].clip_name, 'clip &5', 'Failed clip name test char 5') self.assertEqual(s.events[5].src_start_tc.frames, 697, "Wrong Source start complex event") self.assertEqual(s.events[5].src_end_tc.frames, 697, "Wrong Source end complex event") self.assertEqual(s.events[5].rec_start_tc.frames, 2857, "Wrong Source start complex event") self.assertEqual(s.events[5].rec_end_tc.frames, 2857, "Wrong Source end complex event")
def parse_edl(self, cdl_string): if self._edls_enabled: self.item_type = CDL.COLOR_CORRECTION parser = edl.Parser(self._timebase) edl_list = parser.parse(cdl_string) for event in edl_list: color_correction = ColorCorrection( cdl_edl_strings=event.get_comments(), source_file=self._filename) self._color_items.append(color_correction)
def testing_to_edl_method_will_output_the_standard_edl_case3(self): """testing if to_string will output the EDL as string """ p = edl.Parser('24') with open('../tests/test_data/test_50.edl') as f: s = p.parse(f) with open('../tests/test_data/test_50.edl') as f: expected_edl = f.readlines() print s.to_string() self.assertEqual(''.join(expected_edl), s.to_string())
def send_edl(self, edl_path, media_path): """Sends the edl with the given path to AVID, also copies the MXF files to the media folder path :param edl_path: The edl path :param media_path: The AVID media files path """ # get the source clips from edl import edl parser = edl.Parser('24') # just use some random frame rate with open(edl_path) as f: l = parser.parse(f) total_item_count = len(l) + 1 progress_dialog = QtGui.QProgressDialog(self) progress_dialog.setRange(0, total_item_count) progress_dialog.setLabelText('Copying MXF files...') progress_dialog.show() step = 0 progress_dialog.setValue(step) for event in l: # assert isinstance(event, edl.Event) mov_full_path = event.source_file mxf_full_path = os.path.expandvars( os.path.splitext(mov_full_path)[0] + '.mxf' ) target_mxf_path = os.path.expandvars( os.path.join( media_path, os.path.basename(mxf_full_path) ) ) shutil.copy( mxf_full_path, target_mxf_path ) step += 1 progress_dialog.setValue(step) # and call EDL_Manager.exe with the edl_path progress_dialog.setLabelText('Calling EDL Manager...') step += 1 progress_dialog.setValue(step) subprocess.call(['EDL_Mgr', os.path.normcase(edl_path)], shell=False)
def test_2398fps(self): p = edl.Parser('23.98') with open('test-edls/test_2398.edl') as f: s = p.parse(f)
def test_ntsc(self): p = edl.Parser('29.97') with open('test-edls/test_2997NDF.edl') as f: s = p.parse(f)
def test_pal(self): p = edl.Parser('25') with open('test-edls/test_25.edl') as f: s = p.parse(f)
def test_2398fps(self): p = edl.Parser('23.98') with open('../tests/test_data/test_2398.edl') as f: s = p.parse(f)
def test_pal(self): p = edl.Parser('25') with open('../tests/test_data/test_25.edl') as f: s = p.parse(f)