Beispiel #1
0
Datei: tui.py Projekt: ekohl/next
    def do_add_show(self, line=None):
        '''
        A TUI function that adds a user-specified show to the database. Uses TVRage
        to find out details about the show.
        '''
        #query the user for the show they want to add
        found_show = None
        while not found_show:
            print u'Please enter the name of the show you would like to add.'
            wanted = get_input(term=u'Showname: ')
            #find the show in tvrage
            print u'Searching for show in TVRage database... ',
            shows = parser.fuzzy_search(wanted)
            print u'done.'
            if not shows:
                print u'No shows could be found, please try other keywords!'
                return
            else:
                print u'Which show would you like to add?'
                for (i, show) in enumerate(shows):
                    print u'{0:3d}. {1}'.format(i + 1, show[0])
                number = int(get_input(u'Show number: ', range(1, len(shows) + 1)))
                found_show = shows[number - 1]

        print u'Getting all show eps from TVRage... ',
        episodes = parser.get_all_eps(found_show[1]) #find eps by sid
        print u'done.'
        
        print u'Storing eps in db... ',
        db.store_tvr_eps(self.conf, episodes)
        print u'done.'

        self.add_show_details(found_show)
Beispiel #2
0
Datei: tui.py Projekt: ekohl/next
    def do_scan(self, line=None):
        '''
        A TUI function that scans the user's series folder to find shows that aren't
        in the database yet, then ask the user show by show if he wants to add it
        '''
        unlisted = admin.find_unlisted(self.conf)
        if not unlisted:
            print u'There are no shows to add!'
            return
        for (i, path) in enumerate(unlisted):
            print u'Would you like to add {0}?'.format(path)
            answer = get_input(u'Add [yes]? ')
            if u'y' in answer.lower() or answer == '':
                print u'Searching for show in TVRage database... ',
                shows = parser.fuzzy_search(path.split(' ')[0])
                print u'done.'
                if not shows:
                    print u'No shows could be found, please try other keywords!'
                    return
                else:
                    print u'Which show would you like to add?'
                    for (i, show) in enumerate(shows):
                        print u'{0:3d}. {1}'.format(i + 1, show[0])
                    number = int(get_input(u'Show number: ', range(1, len(shows) + 1)))
                    found_show = shows[number - 1]

                    print u'Getting all show eps from TVRage... ',
                    episodes = parser.get_all_eps(found_show[1]) #find eps by sid
                    print u'done.'
                    
                    print u'Storing eps in db... ',
                    db.store_tvr_eps(self.conf, episodes)
                    print u'done.'

                    self.add_show_details(found_show)
Beispiel #3
0
def update_eps(conf):
    '''
    This method updates the eplist for a given show using the TVRage database
    '''
    #first we check tvr to see if there are any updates for our shows
    print "Updating TVRage episode database...",
    all_shows = db.all_shows(conf)
    try:
        for show in all_shows:
            all_eps = parser.get_all_eps(show.sid)
            db.store_tvr_eps(conf, all_eps)
    except:#probably no internet connection
        print "Could not connect to TVRage, aborting update!"
        return

    process_maybe_finished(conf, all_shows)
    print "done."