Пример #1
0
    def ask(self, key):
        get = ask_user('\nLetter, [s]kip, skip [r]est of show, [q]uit, [m]ark as watched, or [enter] for #1: ')
        choice = False

        if get == 'q':  # quit
            exit()
        elif get == 's':  # skip
            choice = 'skip'
        elif get == 'r':  # skip rest of series
            choice = 'skip_rest'
        elif get == 'm':  # mark show as watched, but don't download it
            choice = 'mark'
        elif get in key:  # number/letter chosen
            choice_num = key.index(get)
            if choice_num not in range(len(self.table.body)):
                self.display_error('Choice not between %s and %s, try again:' % (
                    key[0], key[len(self.table.body) - 1]))
            else:
                choice = self.table.body[choice_num][-1:][0]
        elif get == '[enter]':  # default choice: #1
            choice = self.table.body[0][-1:][0]
        elif get not in key:
            self.display_error('Invalid choice: %s, try again:' % get)

        return choice
Пример #2
0
    def ask_postdownload(self, key):
        get = ask_user('\nLetter or [q]uit: ')
        choice = False

        if get == 'q':
            exit()
        elif get in key:  # number/letter chosen
            choice_num = key.index(get)
            if choice_num not in range(len(self.table.body)):
                self.display_error('Choice not between %s and %s, try again:' % (
                    key[0], key[len(self.table.body) - 1]))
            else:
                choice = self.table.body[choice_num][-1:][0]
        elif get not in key:
            self.display_error('Invalid choice: %s, try again:' % get)

        return choice