def orig_titled(orig_mp4_filename): """Prepare all files in original language: m4a, mp4, mp3""" lang = meta.get_lang(orig_mp4_filename) # first we cut m4a and mp4 version sequentially because these are # IO-bound tasks on the single drive, so running them in parallel # doesn't make much sense. _cut_orig_m4a(orig_mp4_filename, lang, line=0) cut_video_filename = meta.get_work_filename(orig_mp4_filename, ' ' + lang + ' titled.mkv') _cut_orig_mp4_titled(orig_mp4_filename, cut_video_filename, lang, line=1) # And now we run two long-running tasks (uploading to youtube # and encoding mp3) in parallel p_upload_orig_mp4 = multiprocessing.Process( target=_upload_orig_mp4, kwargs={'orig_mp4_filename': orig_mp4_filename, 'cut_video_filename': cut_video_filename, 'lang': lang, 'line': 2}) p_upload_orig_mp4.start() p_encode_orig_mp3 = multiprocessing.Process( target=_encode_orig_mp3, kwargs={'orig_mp4_filename': orig_mp4_filename, 'lang': lang, 'line': 3}) p_encode_orig_mp3.start() p_upload_orig_mp4.join() p_encode_orig_mp3.join()
def load_metadata(self, source_filename): self.lang.set(meta.get_lang(source_filename)) self.lang_option_menu.configure(state='enable') self.title_rus.set(meta.get_title_ru(source_filename)) self.enable_widget(self.title_rus_entry) self.title_eng.set(meta.get_title_en(source_filename)) self.enable_widget(self.title_eng_entry) self.descr_rus_active = False descr = meta.get_description_ru(source_filename).strip() self.replace_text_in_text_widget(self.descr_rus_widget, descr) self.descr_rus_active = True self.descr_eng_active = False descr = meta.get_description_en(source_filename).strip() self.replace_text_in_text_widget(self.descr_eng_widget, descr) self.descr_eng_active = True self.skip_var.set(meta.get_skip_time(source_filename)) self.enable_widget(self.skip_entry) self.cut_var.set(meta.get_cut_time(source_filename)) self.enable_widget(self.cut_entry)
def main(): filename = sys.argv[1] # make_title_mp4(filename, meta.get_lang(filename)) # make_rest_mp4(filename, meta.get_lang(filename)) # get_keyframes_timestamps(filename) lang = meta.get_lang(filename) cut_video_filename = meta.get_work_filename(filename, ' {} titled.mp4'.format(lang)) make_mp4_with_title(filename, lang, cut_video_filename) cut_video_filename_ru = meta.get_work_filename( filename, ' {} titled.mp4'.format('ru')) make_mp4_with_title(filename, 'ru', cut_video_filename_ru)
def test_get_lang_en_default(self): filename = self.get_test_filename('2016-10-12 brmadhusudan.mp4') expected = 'en' self.assertEqual(expected, meta.get_lang(filename))
def test_get_lang(self): filename = self.get_test_filename('2016-10-17 avadhutmj.mp4') expected = 'ru' self.assertEqual(expected, meta.get_lang(filename))
def lang_changed_callback(self): new_lang = self.lang.get() old_lang = meta.get_lang(self.filename.get()) if new_lang != old_lang: meta.update_yaml(self.filename.get(), 'lang', new_lang)