def time_callback(self): """ This method launches all the conversion stages when needed, using the standard executor interface to manage all of them in an easy way """ self.total.set_text(str(self.current_action)+"/"+str(len(self.queue)-1)) self.total.set_fraction(float(self.current_action)/(float(len(self.queue)-1))) if self.runner!=None: if self.runner.initerror: retval=-1; else: retval=self.runner.refresh() if retval==0: # no error, still running return True else: self.current_action+=1 retval=self.runner.wait_end() if (retval!=0) or (self.runner.initerror): self.window.hide() self.window.destroy() if self.runner.print_error==None: self.runner.print_error=_("Unknown error") self.show_error(self.runner.print_error) (self.main_window_callback)() return False else: self.runner.end_process(self.eraser,self.erase_temp) self.runner=None action=self.queue[self.current_action] if (self.global_vars["multicore"]!=1) and (self.global_vars["hyperthreading"]==False): cores=self.global_vars["hypercores"] else: cores=self.global_vars["cores"] if action[0]=="M1": self.runner=action[1] self.runner.create_menu1(action[2],action[3],cores) return True if (action[0]=='C') or (action[0]=='C1') or (action[0]=='C2'): title=action[1] chapter=action[2] if action[0]=="C": encpass = 0 else: encpass = int(action[0][1]) print "Segundos "+str(self.seconds) if (self.global_vars["encoder_video"]=="ffmpeg"): self.runner=devede_ffmpeg_convert.video_converter_ffmpeg(self.global_vars,self.structure[title][chapter+1],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],title+1,chapter+1,cores,self.seconds, encpass,self.global_vars["AC3_fix_ffmpeg"]) elif (self.global_vars["encoder_video"]=="avconv"): self.runner=devede_avconv_convert.video_converter_ffmpeg(self.global_vars,self.structure[title][chapter+1],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],title+1,chapter+1,cores,self.seconds, encpass,self.global_vars["AC3_fix_avconv"]) else: self.runner=devede_video_convert.video_converter(self.global_vars,self.structure[title][chapter+1],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],title+1,chapter+1,cores,self.seconds, encpass,self.global_vars["AC3_fix"]) return True if action[0]=="C2": title=action[1] chapter=action[2] if (self.global_vars["encoder_video"]=="ffmpeg"): self.runner=devede_ffmpeg_convert.video_converter_ffmpeg(self.structure[title][chapter+1],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],title+1,chapter+1,cores,self.seconds, 2,self.global_vars["AC3_fix_ffmpeg"]) elif (self.global_vars["encoder_video"]=="avconv"): self.runner=devede_avconv_convert.video_converter(self.structure[title][chapter+1],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],title+1,chapter+1,cores,self.seconds, 2,self.global_vars["AC3_fix_avconv"]) else: self.runner=devede_video_convert.video_converter(self.structure[title][chapter+1],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],title+1,chapter+1,cores,self.seconds, 2,self.global_vars["AC3_fix"]) return True if action[0]=="S": title=action[1] chapter=action[2] sub_stream=action[3] self.runner=devede_subtitles.subtitles_adder(self.structure[title][chapter+1],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],title+1,chapter+1,sub_stream) return True if action[0]=="PREVIEW": self.window.hide() self.window.destroy() if (sys.platform=="win32") or (sys.platform=="win64"): mplay="mplayer.exe" else: mplay="mplayer" fname=self.filefolder+"previewfile_01_01." if self.disk_type=="divx": fname+="avi" else: fname+="mpg" parameters=[mplay,"-sid","0",fname,"-loop","1"] newtree=devede_other.create_tree(self,"wpreviewagain_dialog",self.gladefile,False) w=newtree.get_object("wpreviewagain_dialog") while True: salida=devede_executor.executor("previewfile",self.filefolder,None) salida.launch_program(parameters,output=False) salida.wait_end() w.show() ret=w.run() w.hide() if ret!=-6: break while gtk.events_pending(): gtk.main_iteration() w.destroy() os.remove(fname) return False if action[0]=="DVD_STRUCTURE": self.runner=devede_dvd.dvd_generator(self.filename,self.filefolder,self.partial,self.label) return True if action[0]=="CD_IMAGE": self.runner=devede_bincue.xvcd_generator(self.filename,self.filefolder,self.partial,self.label,self.structure,self.disk_type) return True if action[0]=="DVD_IMAGE": self.runner=devede_bincue.iso_generator(self.filename,self.filefolder,self.partial,self.label,self.iso_creator) return True if action[0]=="END": self.show_final_time() return False return True
def time_callback(self): """ This method launches all the conversion stages when needed, using the standard executor interface to manage all of them in an easy way """ if self.runner != None: retval = self.runner.refresh() if retval == 0: # no error, still running return True else: self.total_done += 1.0 self.total.set_fraction(self.total_done / (float(self.total_actions))) self.total.set_text( str(int(self.total_done)) + "/" + str(self.total_actions)) retval = self.runner.wait_end() if retval != 0: self.show_error(self.runner.print_error) self.main_window.show() return False else: self.runner.end_process(self.eraser, self.erase_temp) self.runner = None if (self.current_action == "add_subtitles"): self.current_action = "convert_file" self.current_chapter += 1 if (self.current_chapter >= len( self.structure[self.current_title])): self.current_chapter = 1 self.current_title += 1 if (self.current_title < len(self.structure)): self.runner = devede_video_convert.video_converter( self.structure[self.current_title][self.current_chapter], self.filename, self.filefolder, self.partial, self.label, self.global_vars["disctocreate"], self.current_title + 1, self.current_chapter, self.seconds) return True if self.seconds == 0: self.current_action = "create_disc" else: self.current_action = "show_preview" if self.current_action == "convert_file": self.current_action = "add_subtitles" if self.structure[self.current_title][ self.current_chapter]["subtitles"] != "": self.runner = devede_subtitles.subtitles_adder( self.structure[self.current_title][self.current_chapter], self.filename, self.filefolder, self.partial, self.label, self.global_vars["disctocreate"], self.current_title + 1, self.current_chapter) return True if self.current_action == "show_preview": self.window.hide() self.window.destroy() if sys.platform == 'win32': mplay = "mplayer.exe" else: mplay = "mplayer" parameters = [ mplay, "-sid", "0x20", self.filefolder + "previewfile_01_01.mpg" ] newtree = gtk.glade.XML(self.gladefile, "wpreviewagain_dialog", domain="devede") w = newtree.get_widget("wpreviewagain_dialog") while True: salida = devede_executor.executor("previewfile", self.filefolder, None) salida.launch_program(parameters, output=False) salida.wait_end() w.show() ret = w.run() w.hide() if ret != -6: break while gtk.events_pending(): gtk.main_iteration() w.destroy() os.remove(self.filefolder + "previewfile_01_01.mpg") return False if self.current_action == "create_disc": if self.actions == 1: # only convert files self.show_final_time() return False if self.disk_type == "dvd": self.runner = devede_dvd.dvd_generator(self.filename, self.filefolder, self.partial, self.label) else: self.runner = devede_bincue.xvcd_generator( self.filename, self.filefolder, self.partial, self.label, self.structure, self.disk_type) self.current_action = "create_iso" return True if self.current_action == "create_iso": if self.actions == 2: # convert and do dvd structure/create BIN/CUE self.show_final_time() return False self.runner = devede_bincue.iso_generator(self.filename, self.filefolder, self.partial, self.label) self.current_action = "ended" return True if self.current_action == "ended": self.show_final_time() return False return True
def time_callback(self): """ This method launches all the conversion stages when needed, using the standard executor interface to manage all of them in an easy way """ self.total.set_text( str(self.current_action) + "/" + str(len(self.queue) - 1)) self.total.set_fraction( float(self.current_action) / (float(len(self.queue) - 1))) if self.runner != None: if self.runner.initerror: retval = -1 else: retval = self.runner.refresh() if retval == 0: # no error, still running return True else: self.current_action += 1 retval = self.runner.wait_end() if (retval != 0) or (self.runner.initerror): self.window.hide() self.window.destroy() if self.runner.print_error == None: self.runner.print_error = _("Unknown error") self.show_error(self.runner.print_error) (self.main_window_callback)() return False else: self.runner.end_process(self.eraser, self.erase_temp) self.runner = None action = self.queue[self.current_action] if action[0] == "M1": self.runner = action[1] self.runner.create_menu1(action[2], action[3], self.global_vars["multicore"]) return True if (action[0] == 'C') or (action[0] == 'C1') or (action[0] == 'C2'): title = action[1] chapter = action[2] if action[0] == "C": encpass = 0 else: encpass = int(action[0][1]) print "Segundos " + str(self.seconds) if (self.global_vars["use_ffmpeg"]): self.runner = devede_ffmpeg_convert.video_converter_ffmpeg( self.global_vars, self.structure[title][chapter + 1], self.filename, self.filefolder, self.partial, self.label, self.global_vars["disctocreate"], title + 1, chapter + 1, self.global_vars["multicore"], self.seconds, encpass, self.global_vars["AC3_fix"]) else: self.runner = devede_video_convert.video_converter( self.global_vars, self.structure[title][chapter + 1], self.filename, self.filefolder, self.partial, self.label, self.global_vars["disctocreate"], title + 1, chapter + 1, self.global_vars["multicore"], self.seconds, encpass, self.global_vars["AC3_fix"]) return True if action[0] == "C2": title = action[1] chapter = action[2] if (self.global_vars["use_ffmpeg"]): self.runner = devede_ffmpeg_convert.video_converter_ffmpeg( self.structure[title][chapter + 1], self.filename, self.filefolder, self.partial, self.label, self.global_vars["disctocreate"], title + 1, chapter + 1, self.global_vars["multicore"], self.seconds, 2, self.global_vars["AC3_fix"]) else: self.runner = devede_video_convert.video_converter( self.structure[title][chapter + 1], self.filename, self.filefolder, self.partial, self.label, self.global_vars["disctocreate"], title + 1, chapter + 1, self.global_vars["multicore"], self.seconds, 2, self.global_vars["AC3_fix"]) return True if action[0] == "S": title = action[1] chapter = action[2] sub_stream = action[3] self.runner = devede_subtitles.subtitles_adder( self.structure[title][chapter + 1], self.filename, self.filefolder, self.partial, self.label, self.global_vars["disctocreate"], title + 1, chapter + 1, sub_stream) return True if action[0] == "PREVIEW": self.window.hide() self.window.destroy() if (sys.platform == "win32") or (sys.platform == "win64"): mplay = "mplayer.exe" else: mplay = "mplayer" fname = self.filefolder + "previewfile_01_01." if self.disk_type == "divx": fname += "avi" else: fname += "mpg" parameters = [mplay, "-sid", "0", fname, "-loop", "1"] newtree = devede_other.create_tree(self, "wpreviewagain_dialog", self.gladefile, False) w = newtree.get_object("wpreviewagain_dialog") while True: salida = devede_executor.executor("previewfile", self.filefolder, None) salida.launch_program(parameters, output=False) salida.wait_end() w.show() ret = w.run() w.hide() if ret != -6: break while gtk.events_pending(): gtk.main_iteration() w.destroy() os.remove(fname) return False if action[0] == "DVD_STRUCTURE": self.runner = devede_dvd.dvd_generator(self.filename, self.filefolder, self.partial, self.label) return True if action[0] == "CD_IMAGE": self.runner = devede_bincue.xvcd_generator( self.filename, self.filefolder, self.partial, self.label, self.structure, self.disk_type) return True if action[0] == "DVD_IMAGE": self.runner = devede_bincue.iso_generator(self.filename, self.filefolder, self.partial, self.label, self.iso_creator) return True if action[0] == "END": self.show_final_time() return False return True
def time_callback(self): """ This method launches all the conversion stages when needed, using the standard executor interface to manage all of them in an easy way """ if self.runner!=None: retval=self.runner.refresh() if retval==0: # no error, still running return True else: self.total_done+=1.0 self.total.set_fraction(self.total_done/(float(self.total_actions))) self.total.set_text(str(int(self.total_done))+"/"+str(self.total_actions)) retval=self.runner.wait_end() if retval!=0: self.show_error(self.runner.print_error) self.main_window.show() return False else: self.runner.end_process(self.eraser,self.erase_temp) self.runner=None if (self.current_action=="add_subtitles"): self.current_action="convert_file" self.current_chapter+=1 if (self.current_chapter>=len(self.structure[self.current_title])): self.current_chapter=1 self.current_title+=1 if (self.current_title<len(self.structure)): self.runner=devede_video_convert.video_converter(self.structure[self.current_title][self.current_chapter],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],self.current_title+1,self.current_chapter,self.seconds) return True if self.seconds==0: self.current_action="create_disc" else: self.current_action="show_preview" if self.current_action=="convert_file": self.current_action="add_subtitles" if self.structure[self.current_title][self.current_chapter]["subtitles"]!="": self.runner=devede_subtitles.subtitles_adder(self.structure[self.current_title][self.current_chapter],self.filename,self.filefolder,self.partial,self.label,self.global_vars["disctocreate"],self.current_title+1,self.current_chapter) return True if self.current_action=="show_preview": self.window.hide() self.window.destroy() if sys.platform=='win32': mplay="mplayer.exe" else: mplay="mplayer" parameters=[mplay,"-sid","0x20",self.filefolder+"previewfile_01_01.mpg"] newtree=gtk.glade.XML(self.gladefile,"wpreviewagain_dialog",domain="devede") w=newtree.get_widget("wpreviewagain_dialog") while True: salida=devede_executor.executor("previewfile",self.filefolder,None) salida.launch_program(parameters,output=False) salida.wait_end() w.show() ret=w.run() w.hide() if ret!=-6: break while gtk.events_pending(): gtk.main_iteration() w.destroy() os.remove(self.filefolder+"previewfile_01_01.mpg") return False if self.current_action=="create_disc": if self.actions==1: # only convert files self.show_final_time() return False if self.disk_type=="dvd": self.runner=devede_dvd.dvd_generator(self.filename,self.filefolder,self.partial,self.label) else: self.runner=devede_bincue.xvcd_generator(self.filename,self.filefolder,self.partial,self.label,self.structure,self.disk_type) self.current_action="create_iso" return True if self.current_action=="create_iso": if self.actions==2: # convert and do dvd structure/create BIN/CUE self.show_final_time() return False self.runner=devede_bincue.iso_generator(self.filename,self.filefolder,self.partial,self.label) self.current_action="ended" return True if self.current_action=="ended": self.show_final_time() return False return True