From: <te...@us...> - 2004-03-05 00:34:03
|
Update of /cvsroot/quickrip/ng/cli In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22847/cli Modified Files: cli.py Log Message: Finished configuration screen in cli.py (including support work in base.py and config.py) Index: cli.py =================================================================== RCS file: /cvsroot/quickrip/ng/cli/cli.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cli.py 4 Mar 2004 02:30:02 -0000 1.3 --- cli.py 5 Mar 2004 00:12:28 -0000 1.4 *************** *** 121,126 **** 'object' : self.titles[t_index] } self.choices['a'] = { 'question' : 'Enter new audio bitrate in kbps:', ! 'options' : ['32', '48', '64', '96', '128', '160', '192', \ ! '256', '350'], 'param' : 'abr', 'object' : self.titles[t_index] } --- 121,125 ---- 'object' : self.titles[t_index] } self.choices['a'] = { 'question' : 'Enter new audio bitrate in kbps:', ! 'options' : config.audio_bitrates, 'param' : 'abr', 'object' : self.titles[t_index] } *************** *** 144,147 **** --- 143,148 ---- print output.bold('Configure QuickRip') print "" + print "(l) Logging: \t\t%s" % (self.config['logging']) + print "" print "Paths:" print "(m) Mplayer path: \t%s" % (self.config['mplayer']) *************** *** 154,165 **** print "Encoding:" print "(v) Video codec: \t%s" % (self.config['videocodec']) ! print "(s) Video aspect ratio:\t%s" % (self.config['aspectratio']) print "(i) De-interlacing: \t%s" % (self.config['deinterlacing']) print "(z) PDA Mode: \t\t%s" % (self.config['pdamode']) print "(a) Audio codec: \t%s" % (self.config['audiocodec']) ! print "(v) Volume adjustment: \t%s" % (self.config['volumead']) print "" print output.bold("Enter letter to change option, or 'b' to return to the title list screen") self.choices = {} self.askLevelOrQuestion() --- 155,219 ---- print "Encoding:" print "(v) Video codec: \t%s" % (self.config['videocodec']) ! print "(r) Video aspect ratio:\t%s" % (self.config['aspectratio']) print "(i) De-interlacing: \t%s" % (self.config['deinterlacing']) print "(z) PDA Mode: \t\t%s" % (self.config['pdamode']) print "(a) Audio codec: \t%s" % (self.config['audiocodec']) ! print "(j) Volume adjustment: \t%s" % (self.config['volumead']) print "" print output.bold("Enter letter to change option, or 'b' to return to the title list screen") self.choices = {} + self.choices['l'] = { 'question' : 'Choose a logging level: ', + 'options' : ['Off', 'Normal', 'Debug'], + 'param' : 'logging', + 'object' : self.config } + self.choices['m'] = { 'question' : 'Enter new path for mplayer: ', + 'options' : '^[\w\/]+$', + 'param' : 'mplayer', + 'object' : self.config } + self.choices['e'] = { 'question' : 'Enter new path for mencoder: ', + 'options' : '^[\w\/]+$', + 'param' : 'mencoder', + 'object' : self.config } + self.choices['t'] = { 'question' : 'Enter new path for transcode: ', + 'options' : '^[\w\/]+$', + 'param' : 'transcode', + 'object' : self.config } + self.choices['o'] = { 'question' : 'Enter new path for ogmmerge: ', + 'options' : '^[\w\/]+$', + 'param' : 'ogmmerge', + 'object' : self.config } + self.choices['p'] = { 'question' : 'Enter the new output directory: ', + 'options' : '^[\w\/]+$', + 'param' : 'outputdir', + 'object' : self.config } + self.choices['d'] = { 'question' : 'Enter the path to the DVD device: ', + 'options' : '^[\w\/]+$', + 'param' : 'dvd_device', + 'object' : self.config } + self.choices['v'] = { 'question' : 'Enter the new video codec: ', + 'options' : config.video_codecs, + 'param' : 'videocodec', + 'object' : self.config } + self.choices['r'] = { 'question' : 'Enter the new video aspect ratio: ', + 'options' : config.aspect_ratios, + 'param' : 'aspectratio', + 'object' : self.config } + self.choices['i'] = { 'question' : 'Do you want de-interlacing? ', + 'options' : ['On', 'Off'], + 'param' : 'deinterlacing', + 'object' : self.config } + self.choices['z'] = { 'question' : 'Do you want use the PDA mode? ', + 'options' : ['On', 'Off'], + 'param' : 'pdamode', + 'object' : self.config } + self.choices['a'] = { 'question' : 'Enter the new audio codec: ', + 'options' : config.audio_codecs, + 'param' : 'audiocodec', + 'object' : self.config } + self.choices['j'] = { 'question' : 'Volume adjustment: ', + 'options' : ['0', '1', '2', '3', '4', '5', '6', '7', '8', \ + '9', '10'], + 'param' : 'volumead', + 'object' : self.config } self.askLevelOrQuestion() *************** *** 204,218 **** sys.exit(2) # Check the input is valid ! try: ! self.choices[self.choice]['options'].append if self.option_choice not in self.choices[self.choice]['options']: print output.bold("You chose '%s', which isn't a valid choice. Try again." % \ (self.option_choice)) self.askOption() ! except: if not re.search(self.choices[self.choice]['options'], self.option_choice): ! print output.bold("You chose '%s', which isn't a valid choice. Try again." % \ ! (self.option_choice)) self.askOption() # Change the option self.choices[self.choice]['object'][self.choices[self.choice]['param']] = self.option_choice --- 258,278 ---- sys.exit(2) # Check the input is valid ! if isinstance(self.choices[self.choice]['options'], type([])): if self.option_choice not in self.choices[self.choice]['options']: print output.bold("You chose '%s', which isn't a valid choice. Try again." % \ (self.option_choice)) self.askOption() ! else: if not re.search(self.choices[self.choice]['options'], self.option_choice): ! print output.bold("You chose '%s', which isn't a valid choice. Try again." % (self.option_choice)) self.askOption() + # Maybe check the path is valid? + if self.choices[self.choice]['param'] in self.variables.keys(): + if self.variables[self.choices[self.choice]['param']][0] == 'paths': + if not os.path.exists(self.option_choice): + msg = "You chose '%s', which isn't a valid choice. Try again." \ + % (self.option_choice) + print output.bold(msg) + self.askOption() # Change the option self.choices[self.choice]['object'][self.choices[self.choice]['param']] = self.option_choice *************** *** 227,231 **** self.choices[self.choice]['object']['length'], \ self.choices[self.choice]['object']['abr'], \ ! self.choices[self.choice]['object']['size']) # Return to appropriate level if self.choices[self.choice]['object'].has_key('id'): --- 287,294 ---- self.choices[self.choice]['object']['length'], \ self.choices[self.choice]['object']['abr'], \ ! self.choices[self.choice]['object']['size']) ! # Maybe save the config file? ! if self.choices[self.choice]['object'] is self.config: ! self.saveConfig() # Return to appropriate level if self.choices[self.choice]['object'].has_key('id'): |