def check_free_space(self, filefolder, structure, actions, erase_temporary_files, sound_duration): """ Returns TRUE if the free space in FILEFOLDER is insuficient to generate the disk STRUCTURE """ # TODO Windows Stuff estado = '' freespace = '' if (sys.platform != "win32") and (sys.platform != "win64"): print "Checking " + str(filefolder) estado = os.statvfs( filefolder ) # eg. f="C:\Documents and Settings\User name\Desktop" freespace = 95 * estado.f_bsize * estado.f_bavail / 100000 else: try: test_drive = os.path.splitdrive(filefolder)[ 0] + "\\" # So it will also work on Windows 2000 spc, bps, fc, tc = win32api.GetDiskFreeSpace(test_drive) freespace = fc * spc * bps except ImportError: pass print "Free space in " + str(filefolder) + ": " + str(freespace) print "estatus ", estado, "\n" total = devede_other.calcula_tamano_total(structure, sound_duration, self.disk_type) print "Free: " + str(freespace) print "Needed: " + str(total) if (actions != 3): total *= actions # if we only create the MPEG files or the DVD structure... else: if erase_temporary_files: # or if we create the ISO image total *= 2 else: total *= 3 total *= 1.1 # a safe margin of 10% if (freespace < total): return True, _( "Insuficient free space. To create this disc\n%(total)d MBytes are needed, but only %(free)d MBytes are available." ) % { 'total': int(total / 1000), 'free': int(freespace / 1000) } else: return False, ""
def check_free_space(self,filefolder,structure,actions,erase_temporary_files,sound_duration): """ Returns TRUE if the free space in FILEFOLDER is insuficient to generate the disk STRUCTURE """ # TODO Windows Stuff estado='' freespace='' if (sys.platform!="win32") and (sys.platform!="win64"): try: print "Checking "+str(filefolder) estado=os.statvfs(filefolder) # eg. f="C:\Documents and Settings\User name\Desktop" freespace=95*estado.f_bsize*estado.f_bavail/100000 except ImportError: print "Error when checking free space" freespace=0 else: try: test_drive = os.path.splitdrive(filefolder)[0] + "\\" # So it will also work on Windows 2000 spc, bps, fc, tc = win32api.GetDiskFreeSpace(test_drive) freespace=fc * spc * bps except ImportError: freespace=0 print "Free space in "+str(filefolder)+": "+str(freespace) print "estatus ", estado, "\n" total=devede_other.calcula_tamano_total(structure,sound_duration,self.disk_type) print "Free: "+str(freespace) print "Needed: "+str(total) if (actions!=3): total*=actions # if we only create the MPEG files or the DVD structure... else: if erase_temporary_files: # or if we create the ISO image total*=2 else: total*=3 total*=1.1 # a safe margin of 10% if (freespace<total): return True,_("Insuficient free space. To create this disc\n%(total)d MBytes are needed, but only %(free)d MBytes are available.") % {'total':int(total/1000),'free':int(freespace/1000)} else: return False,""
def set_video_values(self): """ Sets the video values in the main window when the user clicks a chapter """ title,chapter=self.get_marked() if (chapter!=-1) and (title!=-1) and (title<len(self.structure)) and (chapter<len(self.structure[title])): found2=self.structure[title] found=found2[chapter] w=self.tree.get_object("oaspect") if (found["aspect"])>1.5: w.set_text("16:9") else: w.set_text("4:3") w=self.tree.get_object("o_size") w.set_text(str(found["owidth"])+"x"+str(found["oheight"])) w=self.tree.get_object("leng") w.set_text(str(found["olength"])) w=self.tree.get_object("vrate") w.set_text(str(found["vrate"])) w=self.tree.get_object("arate") w.set_text(str(found["arate"])) w=self.tree.get_object("eleng") speed1,speed2=devede_other.get_speedup(found) length=devede_other.calcula_tamano_parcial(found["vrate"],found["arate"],found["filesize"],found["olength"],len(found["sub_list"]),found["ismpeg"],found["isvob"],found["cutting"],speed1,speed2) #length=int(((found["vrate"]+found["arate"])*found["olength"])/8000) w.set_text(str(int(length/1000))) w=self.tree.get_object("achap") if found["lchapters"]==0: w.set_text(_("no chapters")) else: w.set_text(str(int(found["lchapters"]))) w=self.tree.get_object("video_format") if found["fps"]==25: w.set_text("25 (PAL)") elif found["fps"]==30: if (found["ofps"]==24) and (self.disctocreate!="vcd") and (self.disctocreate!="svcd") and (self.disctocreate!="cvd"): w.set_text("24 (NTSC)") else: w.set_text("30 (NTSC)") else: w.set_text(str(int(found["fps"]))) w=self.tree.get_object("fsizem") w.set_text(str(found["width"])+"x"+str(found["height"])) else: w=self.tree.get_object("oaspect") w.set_text("") w=self.tree.get_object("o_size") w.set_text("") w=self.tree.get_object("leng") w.set_text("") w=self.tree.get_object("vrate") w.set_text("") w=self.tree.get_object("arate") w.set_text("") w=self.tree.get_object("eleng") w.set_text("") w=self.tree.get_object("achap") w.set_text("") w=self.tree.get_object("video_format") w.set_text("") w=self.tree.get_object("fsizem") w.set_text("") total=devede_other.calcula_tamano_total(self.structure,self.global_vars["menu_sound_duration"],self.disctocreate) total/=1000 tamano,minvrate,maxvrate = devede_other.get_dvd_size(self.tree,self.disctocreate) w=self.tree.get_object("usage") if total>tamano: w.set_fraction(1.0) addv=1 else: w.set_fraction(total/tamano) addv=0 w.set_text(str(addv+int((total/tamano)*100))+"%")