From: <te...@us...> - 2004-03-03 02:05:18
|
Update of /cvsroot/quickrip/ng/cli In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28094/cli Modified Files: cli.py Removed Files: cli.pyc Log Message: Minor additions to base and cli. Removed .pyc files from repository. Index: cli.py =================================================================== RCS file: /cvsroot/quickrip/ng/cli/cli.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** cli.py 1 Mar 2004 17:00:42 -0000 1.1.1.1 --- cli.py 3 Mar 2004 01:45:15 -0000 1.2 *************** *** 28,40 **** class CLI(QuickRip): """CLI-specific functions to add a CLI to the QuickRip base class: ! switch() - send user into various modes (entry, toplevel, title) ! front() - show the front screen ! toplevel() - show the top level screen ! showTitle() - show the title information screen ! configure() - show the configuration screen ! askLevel() - select new level or question to ask ! askOption() - ask for new value for option, and change option""" def switch(self, mode, title=1): os.system("clear") print output.bold("%s v%s, %s\n" % (__app__, __version__, __copyright__)) --- 28,41 ---- class CLI(QuickRip): """CLI-specific functions to add a CLI to the QuickRip base class: ! switch() - send user into various modes (entry, toplevel, title) ! front() - show the front screen ! toplevel() - show the top level screen ! showTitle() - show the title information screen ! configure() - show the configuration screen ! askLevelOrQuestion() - select new level or question to ask ! askOption() - ask for new value for option, and change option""" def switch(self, mode, title=1): + """send user into various modes (entry, toplevel, title)""" os.system("clear") print output.bold("%s v%s, %s\n" % (__app__, __version__, __copyright__)) *************** *** 51,54 **** --- 52,56 ---- def front(self): + """show the front screen""" print output.bold("\nHit enter to scan DVD") try: *************** *** 63,66 **** --- 65,69 ---- def toplevel(self): + """show the top level screen""" print output.bold(''.join(["Disc: ", self.raw_dvd['label']])) print "Titles on DVD: ((*) means title will be ripped)" *************** *** 76,83 **** print output.bold("Enter letter/title number to edit information, or 'r' to start ripping") self.choices = {} ! self.askLevel() def showTitle(self, id): title = None for t in self.titles: --- 79,87 ---- print output.bold("Enter letter/title number to edit information, or 'r' to start ripping") self.choices = {} ! self.askLevelOrQuestion() def showTitle(self, id): + """show the title information screen""" title = None for t in self.titles: *************** *** 90,96 **** print "(n) Name: \t\t%s" % (title['name']) print " Length: \t\t%s" % (title['timelabel']) ! print "(s) File size: \t%sMB" % (str(title['size'])) ! print "(v) Video bitrate: \t%skbps" % (str(title['vbr'])) ! print "(a) Audio bitrate: \t%skbps" % (str(title['abr'])) print "(r) Rip title? \t%s" % (title['rip']) print "" --- 94,100 ---- print "(n) Name: \t\t%s" % (title['name']) print " Length: \t\t%s" % (title['timelabel']) ! print "(s) File size: \t%sMB" % (str(int(title['size']))) ! print "(v) Video bitrate: \t%skbps" % (str(int(title['vbr']))) ! print "(a) Audio bitrate: \t%skbps" % (str(int(title['abr']))) print "(r) Rip title? \t%s" % (title['rip']) print "" *************** *** 110,114 **** 'object' : self.titles[t_index] } self.choices['a'] = { 'question' : 'Enter new audio bitrate in kbps:', ! 'options' : '\d+', 'param' : 'abr', 'object' : self.titles[t_index] } --- 114,118 ---- '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] } *************** *** 117,124 **** 'param' : 'rip', 'object' : self.titles[t_index] } ! self.askLevel() ! def askLevel(self): try: self.choice = raw_input("> ") --- 121,129 ---- 'param' : 'rip', 'object' : self.titles[t_index] } ! self.askLevelOrQuestion() ! def askLevelOrQuestion(self): ! """select new level or question to ask""" try: self.choice = raw_input("> ") *************** *** 131,135 **** elif self.choice == 'q' and self.level == 'toplevel': print output.bold("Goodbye") ! sys.exit(42) elif self.choice == 'b' and self.level != 'toplevel': self.switch('toplevel') --- 136,140 ---- elif self.choice == 'q' and self.level == 'toplevel': print output.bold("Goodbye") ! sys.exit(2) elif self.choice == 'b' and self.level != 'toplevel': self.switch('toplevel') *************** *** 138,142 **** elif self.choice not in self.choices.keys(): print output.bold("You chose '%s', which isn't a valid choice. Try again." % (self.choice)) ! self.askLevel() else: self.askOption() --- 143,147 ---- elif self.choice not in self.choices.keys(): print output.bold("You chose '%s', which isn't a valid choice. Try again." % (self.choice)) ! self.askLevelOrQuestion() else: self.askOption() *************** *** 144,148 **** def askOption(self): ! print output.bold(self.choices[self.choice]['question']) try: self.option_choice = raw_input("> ") --- 149,160 ---- def askOption(self): ! """ask for new value for option, and change option""" ! question = self.choices[self.choice]['question'] ! if isinstance(self.choices[self.choice]['options'], type([])): ! question = ''.join([question, ' [']) ! for o in self.choices[self.choice]['options']: ! question = ''.join([question, ' ', o, ' ']) ! question = ''.join([question, ']']) ! print output.bold(question) try: self.option_choice = raw_input("> ") *************** *** 164,167 **** --- 176,190 ---- # Change the option self.choices[self.choice]['object'][self.choices[self.choice]['param']] = self.option_choice + # Maybe change filesize/bitrate? + if self.choices[self.choice]['param'] in ['vbr', 'abr']: + self.choices[self.choice]['object']['size'] = self.calcFileSize(\ + self.choices[self.choice]['object']['length'], \ + self.choices[self.choice]['object']['abr'], \ + self.choices[self.choice]['object']['vbr']) + elif self.choices[self.choice]['param'] == 'size': + self.choices[self.choice]['object']['vbr'] = self.calcRate(\ + 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'): *************** *** 177,181 **** def notify_Error(self, message): print output.bold("ERROR: %s" % (message)) ! sys.exit(42) --- 200,204 ---- def notify_Error(self, message): print output.bold("ERROR: %s" % (message)) ! sys.exit(2) --- cli.pyc DELETED --- |