From: <te...@us...> - 2003-07-24 14:13:30
|
Update of /cvsroot/quickrip/quickrip In directory sc8-pr-cvs1:/tmp/cvs-serv18096 Modified Files: cli.py dvd.py gui.py guisettings.py Log Message: Added option of video codec, to choose between DivX and XviD, as requested: https://sourceforge.net/tracker/index.php?func=detail&aid=754961&group_id=79718&atid=557565 Index: cli.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/cli.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** cli.py 17 Jul 2003 13:12:14 -0000 1.14 --- cli.py 24 Jul 2003 14:13:26 -0000 1.15 *************** *** 75,78 **** --- 75,82 ---- aspectratio = self.aro[int(self.config['aspectratio'])] passes = self.config['passes'] + if self.config['videocodec'] == 1: + codec = "XviD" + else: + codec = "DivX" if self.config['pdamode'] == 1: pda = "yes" *************** *** 95,99 **** print "(a) Aspect ration:\t%s" % (aspectratio) print "(p) Mencoder passes:\t%s" % (passes) ! print "(h) PDA mode:\t%s" % (pda) print "" print "(s) Save settings to config file" --- 99,104 ---- print "(a) Aspect ration:\t%s" % (aspectratio) print "(p) Mencoder passes:\t%s" % (passes) ! print "(h) PDA mode:\t\t%s" % (pda) ! print "(c) Video codec:\t%s" % (codec) print "" print "(s) Save settings to config file" *************** *** 258,261 **** --- 263,268 ---- elif choice == 'h': self.changePDAMode() + elif choice == 'c': + self.changeVideoCodec() elif choice == 's': self.saveSettings() *************** *** 332,336 **** self.config['passes'] = choice self.main("settings") ! def changePDAMode(self): print output.bold("\nPDA Mode: (yes/no):") --- 339,343 ---- self.config['passes'] = choice self.main("settings") ! def changePDAMode(self): print output.bold("\nPDA Mode: (yes/no):") *************** *** 348,352 **** self.config['pdamode'] = 0 self.main("settings") ! def saveSettings(self): --- 355,372 ---- self.config['pdamode'] = 0 self.main("settings") ! ! def changeVideoCodec(self): ! print output.bold("\nVideo Codec: (0 = DivX, 1 = XviD):") ! try: ! choice = raw_input("> ") ! except KeyboardInterrupt: ! print output.bold("\n\nExiting...") ! sys.exit(2) ! if choice not in ['0', '1']: ! print output.bold("Invalid option!") ! self.changeVideoCodec() ! self.config['videocodec'] = int(choice) ! self.main("settings") ! def saveSettings(self): *************** *** 357,364 **** --- 377,386 ---- self.parser.set('paths', 'tcprobe', self.config['tcprobe']) self.parser.set('paths', 'outputdir', self.config['outputdir']) + self.parser.set('paths', 'dvd_device', self.config['dvd_device']) self.parser.set('mencoder', 'deinterlacing', self.config['deinterlacing']) self.parser.set('mencoder', 'aspectratio', self.config['aspectratio']) self.parser.set('mencoder', 'passes', self.config['passes']) self.parser.set('mencoder', 'pdamode', self.config['pdamode']) + self.parser.set('mencoder', 'videocodec', self.config['videocodec']) self.parser.write(open(self.configfile, 'w')) print "* Completed" Index: dvd.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/dvd.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** dvd.py 17 Jul 2003 13:12:14 -0000 1.23 --- dvd.py 24 Jul 2003 14:13:26 -0000 1.24 *************** *** 78,81 **** --- 78,87 ---- parser.set("paths", "dvd_device", config['dvd_device']) parser.write(open(self.configfile, 'w')) + try: + config['videocodec'] = parser.get("mencoder", "videocodec") + except: + config['videocodec'] = 0 + parser.set("mencoder", "videocodec", 0) + parser.write(open(self.configfile, 'w')) return (config, parser) *************** *** 122,125 **** --- 128,132 ---- parser.set("mencoder", "passes", 3) parser.set("mencoder", "pdamode", 0) + parser.set("mencoder", "videocodec", 0) parser.write(open(self.configfile, 'w')) *************** *** 316,322 **** lameopts = "".join(["cbr=", str(self.track['abr']), str(self.vol)]) ! ovc = "lavc" ! ovc_opts = "-lavcopts" ! lavcopts = "".join(["vcodec=mpeg4:vhq:vbitrate=", str(int(self.track['vbr']))]) vop = "".join(["scale,crop=",self.track['crop']]) --- 323,334 ---- lameopts = "".join(["cbr=", str(self.track['abr']), str(self.vol)]) ! if self.config['videocodec']: ! ovc = "xvid" ! ovc_opts_type = "-xvidencopts" ! ovc_opts = "".join(["4mv:me_quality=6:mod_quant:quant_range=1-31/1-31:bitrate=", str(int(self.track['vbr']))]) ! else: ! ovc = "lavc" ! ovc_opts_type = "-lavcopts" ! ovc_opts = "".join(["vcodec=mpeg4:vhq:vbitrate=", str(int(self.track['vbr']))]) vop = "".join(["scale,crop=",self.track['crop']]) *************** *** 326,330 **** if self.config['passes'] is 1: all_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-oac", "mp3lame", "-lameopts", lameopts, "-ovc", ovc, ovc_opts, lavcopts, "-vop", vop, "-zoom", \ "-xy", resolution, "-o", self.output, "2>/dev/null"] --- 338,342 ---- if self.config['passes'] is 1: all_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-oac", "mp3lame", "-lameopts", lameopts, "-ovc", ovc, ovc_opts_type, ovc_opts, "-vop", vop, "-zoom", \ "-xy", resolution, "-o", self.output, "2>/dev/null"] *************** *** 345,365 **** # sys.exit(1) - # Uncomment to test command - #string = "" - #for bit in all_pass: - #bit = "".join([" ", bit]) - #string = "".join([string, bit]) - #print string - #sys.exit(1) - self.runPass("audio", all_pass) elif not self.config['passes'] or self.config['passes'] is 2: audio_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-oac", "mp3lame", "-lameopts", lameopts, "-ovc", ovc, "frameno", "-o", \ "".join([self.outdir, "frameno.avi"]), "2>/dev/null"] video_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-sws", "2", "-oac", "copy", "-ovc", ovc, ovc_opts, lavcopts, "-vop", vop, "-zoom", "-xy", resolution, \ "-o", self.output, "2>/dev/null"] --- 357,369 ---- # sys.exit(1) self.runPass("audio", all_pass) elif not self.config['passes'] or self.config['passes'] is 2: audio_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-oac", "mp3lame", "-lameopts", lameopts, "-ovc", "frameno", "-o", \ "".join([self.outdir, "frameno.avi"]), "2>/dev/null"] video_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-sws", "2", "-oac", "copy", "-ovc", ovc, ovc_opts_type, ovc_opts, "-vop", vop, "-zoom", "-xy", resolution, \ "-o", self.output, "2>/dev/null"] *************** *** 394,406 **** elif self.config['passes'] is 3: audio_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-oac", "mp3lame", "-lameopts", lameopts, "-ovc", ovc, "frameno", "-o", \ "".join([self.outdir, "frameno.avi"]), "2>/dev/null"] video_pass1 = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-sws", "2", "-oac", "copy", "-ovc", ovc, ovc_opts, "".join([lavcopts, ":vpass=1"]), "-vop", vop, \ "-zoom", "-xy", resolution, "-o", self.output, "2>/dev/null"] video_pass2 = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-sws", "2", "-oac", "copy", "-ovc", ovc, ovc_opts, "".join([lavcopts, ":vpass=2"]), "-vop", vop, \ "-zoom", "-xy", resolution, "-o", self.output, "2>/dev/null"] --- 398,410 ---- elif self.config['passes'] is 3: audio_pass = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-oac", "mp3lame", "-lameopts", lameopts, "-ovc", "frameno", "-o", \ "".join([self.outdir, "frameno.avi"]), "2>/dev/null"] video_pass1 = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-sws", "2", "-oac", "copy", "-ovc", ovc, ovc_opts_type, "".join([ovc_opts, ":vpass=1"]), "-vop", vop, \ "-zoom", "-xy", resolution, "-o", self.output, "2>/dev/null"] video_pass2 = [str(self.config['mencoder']), "-dvd", str(self.track['id']), "-alang", self.aLanguage, \ ! "-sws", "2", "-oac", "copy", "-ovc", ovc, ovc_opts_type, "".join([ovc_opts, ":vpass=2"]), "-vop", vop, \ "-zoom", "-xy", resolution, "-o", self.output, "2>/dev/null"] Index: gui.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/gui.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gui.py 17 Jul 2003 13:12:14 -0000 1.14 --- gui.py 24 Jul 2003 14:13:26 -0000 1.15 *************** *** 26,29 **** --- 26,30 ---- from guimain import MainWindow from guisettings import dialogSettings + from guiprogressdialogue import dialogueProgress # QuickRip global configuration. *************** *** 39,44 **** - - class GUI(DVD, MainWindow): """GUI-specific functions to add a Qt GUI to the DVD class: --- 40,43 ---- *************** *** 134,139 **** self.Dialogue.pm_videoPass1.setProgress(-1) self.Dialogue.pm_videoPass2.setProgress(-1) ! self.Dialogue.rippingXofY.setText("Ripping " + name + " (" + str(number) + " of " + str(total) + ")") ! def int_newPass(self, passtype): self.passtype = passtype --- 133,138 ---- self.Dialogue.pm_videoPass1.setProgress(-1) self.Dialogue.pm_videoPass2.setProgress(-1) ! self.Dialogue.rippingXofY.setText("".join(["Ripping ", str(name), " (", str(number), " of ", str(total), ")"])) ! def int_newPass(self, passtype): self.passtype = passtype *************** *** 205,208 **** --- 204,208 ---- def updateTrackDisplay(self, track): self.track = track + self.track.info['name'] = self.track.text(0) if abs(int(str(self.fileSize.cleanText())) - self.track.info['size']) > 1: self.fileSize.setValue(self.track.info['size']) *************** *** 286,292 **** # print "\n***Unable to change to directory", qr_dir, "\n(", msg, ")\n" import output ! print output.bold("DEVELOPER: UNCOMMENT THE CHDIR CODE! (LINE 284, GUI.PY)") ! ! from guiprogressdialogue import dialogueProgress self.state = "stopped" --- 286,290 ---- # print "\n***Unable to change to directory", qr_dir, "\n(", msg, ")\n" import output ! print output.bold("DEVELOPER: UNCOMMENT THE CHDIR CODE! (LINE 282, GUI.PY)") self.state = "stopped" *************** *** 353,357 **** self.ripDVD() elif self.state is "ripping": ! print "* Ripping finished" self.Dialogue.rippingXofY.setText("Waiting to start...") try: --- 351,355 ---- self.ripDVD() elif self.state is "ripping": ! print "* Ripping aborted" self.Dialogue.rippingXofY.setText("Waiting to start...") try: *************** *** 390,393 **** --- 388,392 ---- self.Dialogue.aspectRatio.setCurrentItem(int(self.config['aspectratio'])) self.Dialogue.encoderPasses.setCurrentItem(int(self.config['passes'])) + self.Dialogue.videoCodec.setCurrentItem(int(self.config['videocodec'])) if self.config['pdamode'] == 1: self.Dialogue.c_pdamode.setChecked(1) *************** *** 467,470 **** --- 466,470 ---- self.config['aspectratio'] = self.Dialogue.aspectRatio.currentItem() self.config['passes'] = self.Dialogue.encoderPasses.currentItem() + self.config['videocodec'] = self.Dialogue.videoCodec.currentItem() if self.Dialogue.c_pdamode.isChecked(): self.config['pdamode'] = 1 *************** *** 483,486 **** --- 483,487 ---- self.config['aspectratio'] = self.Dialogue.aspectRatio.currentItem() self.config['passes'] = self.Dialogue.encoderPasses.currentItem() + self.config['videocodec'] = self.Dialogue.videoCodec.currentItem() if self.Dialogue.c_pdamode.isChecked(): self.config['pdamode'] = 1 *************** *** 496,499 **** --- 497,501 ---- self.parser.set('mencoder', 'passes', self.config['passes']) self.parser.set('mencoder', 'pdamode', self.config['pdamode']) + self.parser.set('mencoder', 'videocodec', self.config['videocodec']) self.parser.write(open(self.configfile, 'w')) Index: guisettings.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/guisettings.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** guisettings.py 17 Jul 2003 10:41:22 -0000 1.7 --- guisettings.py 24 Jul 2003 14:13:26 -0000 1.8 *************** *** 3,7 **** # Form implementation generated from reading ui file 'ui/guisettings.ui' # ! # Created: Thu Jul 17 11:16:50 2003 # by: The PyQt User Interface Compiler (pyuic) 3.6 # --- 3,7 ---- # Form implementation generated from reading ui file 'ui/guisettings.ui' # ! # Created: Thu Jul 24 12:57:03 2003 # by: The PyQt User Interface Compiler (pyuic) 3.6 # *************** *** 305,326 **** dialogSettingsLayout = QGridLayout(self,1,1,12,6,"dialogSettingsLayout") - layout2 = QHBoxLayout(None,0,6,"layout2") - - self.b_Save = QPushButton(self,"b_Save") - self.b_Save.setIconSet(QIconSet(self.image1)) - layout2.addWidget(self.b_Save) - spacer = QSpacerItem(170,20,QSizePolicy.Expanding,QSizePolicy.Minimum) - layout2.addItem(spacer) - - self.b_OK = QPushButton(self,"b_OK") - self.b_OK.setIconSet(QIconSet(self.image2)) - layout2.addWidget(self.b_OK) - - self.b_Cancel = QPushButton(self,"b_Cancel") - self.b_Cancel.setIconSet(QIconSet(self.image3)) - layout2.addWidget(self.b_Cancel) - - dialogSettingsLayout.addLayout(layout2,2,0) - self.groupBox1 = QGroupBox(self,"groupBox1") self.groupBox1.setSizePolicy(QSizePolicy(5,1,0,0,self.groupBox1.sizePolicy().hasHeightForWidth())) --- 305,308 ---- *************** *** 414,425 **** groupBox2Layout.addWidget(self.l_aspectRatio,0,2) - self.aspectRatio = QComboBox(0,self.groupBox2,"aspectRatio") - - groupBox2Layout.addWidget(self.aspectRatio,0,3) - - self.c_pdamode = QCheckBox(self.groupBox2,"c_pdamode") - - groupBox2Layout.addWidget(self.c_pdamode,1,2) - self.l_deinterlacing = QLabel(self.groupBox2,"l_deinterlacing") self.l_deinterlacing.setSizePolicy(QSizePolicy(5,0,0,0,self.l_deinterlacing.sizePolicy().hasHeightForWidth())) --- 396,399 ---- *************** *** 436,439 **** --- 410,417 ---- groupBox2Layout.addWidget(self.l_Passes,1,0) + self.c_pdamode = QCheckBox(self.groupBox2,"c_pdamode") + + groupBox2Layout.addWidget(self.c_pdamode,2,0) + self.encoderPasses = QComboBox(0,self.groupBox2,"encoderPasses") self.encoderPasses.setSizePolicy(QSizePolicy(1,0,0,0,self.encoderPasses.sizePolicy().hasHeightForWidth())) *************** *** 441,449 **** groupBox2Layout.addWidget(self.encoderPasses,1,1) dialogSettingsLayout.addWidget(self.groupBox2,1,0) self.languageChange() ! self.resize(QSize(521,408).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) --- 419,457 ---- groupBox2Layout.addWidget(self.encoderPasses,1,1) + self.textLabel1_2 = QLabel(self.groupBox2,"textLabel1_2") + + groupBox2Layout.addWidget(self.textLabel1_2,1,2) + + self.aspectRatio = QComboBox(0,self.groupBox2,"aspectRatio") + + groupBox2Layout.addWidget(self.aspectRatio,0,3) + + self.videoCodec = QComboBox(0,self.groupBox2,"videoCodec") + + groupBox2Layout.addWidget(self.videoCodec,1,3) + dialogSettingsLayout.addWidget(self.groupBox2,1,0) + layout2 = QHBoxLayout(None,0,6,"layout2") + + self.b_Save = QPushButton(self,"b_Save") + self.b_Save.setIconSet(QIconSet(self.image1)) + layout2.addWidget(self.b_Save) + spacer = QSpacerItem(170,20,QSizePolicy.Expanding,QSizePolicy.Minimum) + layout2.addItem(spacer) + + self.b_OK = QPushButton(self,"b_OK") + self.b_OK.setIconSet(QIconSet(self.image2)) + layout2.addWidget(self.b_OK) + + self.b_Cancel = QPushButton(self,"b_Cancel") + self.b_Cancel.setIconSet(QIconSet(self.image3)) + layout2.addWidget(self.b_Cancel) + + dialogSettingsLayout.addLayout(layout2,2,0) + self.languageChange() ! self.resize(QSize(519,436).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) *************** *** 461,470 **** def languageChange(self): self.setCaption(self.tr("Configuration - QuickRip")) - self.b_Save.setText(self.tr("&Save settings","g")) - self.b_Save.setAccel(self.tr("Alt+S")) - self.b_OK.setText(self.tr("&OK","g")) - self.b_OK.setAccel(self.tr("Alt+O")) - self.b_Cancel.setText(self.tr("&Cancel","g")) - self.b_Cancel.setAccel(self.tr("Alt+C")) self.groupBox1.setTitle(self.tr("&Paths")) self.l_tcprobe.setText(self.tr("&Tcprobe:")) --- 469,472 ---- *************** *** 505,518 **** self.groupBox2.setTitle(self.tr("Me&ncoder Options")) self.l_aspectRatio.setText(self.tr("As&pect ratio:")) - self.aspectRatio.clear() - self.aspectRatio.insertItem(self.tr("Default")) - self.aspectRatio.insertItem(self.tr("4:3")) - self.aspectRatio.insertItem(self.tr("16:9")) - self.aspectRatio.insertItem(self.tr("2.35:1")) - QToolTip.add(self.aspectRatio,self.tr("Aspect ratio of video")) - QWhatsThis.add(self.aspectRatio,self.tr("The aspect ratio of the video. Change if the output appears stretched. \n" - "DVDs have aspect ratios printed on their cases.")) - self.c_pdamode.setText(self.tr("&PDA mode")) - self.c_pdamode.setAccel(self.tr("Alt+P")) self.l_deinterlacing.setText(self.tr("&De-Interlacing:")) self.deInterlacing.clear() --- 507,510 ---- *************** *** 525,528 **** --- 517,522 ---- QWhatsThis.add(self.deInterlacing,self.tr("De-Interlacing options. For more information on de-interlacing consult the QuickRip and Mplayer documentation.")) self.l_Passes.setText(self.tr("&Encoder passes:")) + self.c_pdamode.setText(self.tr("&PDA mode")) + self.c_pdamode.setAccel(self.tr("Alt+P")) self.encoderPasses.clear() self.encoderPasses.insertItem(self.tr("Default")) *************** *** 530,532 **** --- 524,547 ---- self.encoderPasses.insertItem(self.tr("Two Pass")) self.encoderPasses.insertItem(self.tr("Three Pass")) + self.textLabel1_2.setText(self.tr("Video codec:")) + self.aspectRatio.clear() + self.aspectRatio.insertItem(self.tr("Default")) + self.aspectRatio.insertItem(self.tr("4:3")) + self.aspectRatio.insertItem(self.tr("16:9")) + self.aspectRatio.insertItem(self.tr("2.35:1")) + QToolTip.add(self.aspectRatio,self.tr("Aspect ratio of video")) + QWhatsThis.add(self.aspectRatio,self.tr("The aspect ratio of the video. Change if the output appears stretched. \n" + "DVDs have aspect ratios printed on their cases.")) + self.videoCodec.clear() + self.videoCodec.insertItem(self.tr("DivX")) + self.videoCodec.insertItem(self.tr("XviD")) + QToolTip.add(self.videoCodec,self.tr("Aspect ratio of video")) + QWhatsThis.add(self.videoCodec,self.tr("The aspect ratio of the video. Change if the output appears stretched. \n" + "DVDs have aspect ratios printed on their cases.")) + self.b_Save.setText(self.tr("&Save settings","g")) + self.b_Save.setAccel(self.tr("Alt+S")) + self.b_OK.setText(self.tr("&OK","g")) + self.b_OK.setAccel(self.tr("Alt+O")) + self.b_Cancel.setText(self.tr("&Cancel","g")) + self.b_Cancel.setAccel(self.tr("Alt+C")) |