Example #1
0
File: tui.py Project: Sakartu/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
        '''
        if ConfKeys.UNSTRUCTURED in self.conf and self.conf[ConfKeys.UNSTRUCTURED]:
            print "Cannot scan disk in unstructured mode!"
            return
        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:
                    found_show = read_show(shows)

                    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)
Example #2
0
File: tui.py Project: Sakartu/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:
                found_show = read_show(shows)

        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)
Example #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:
            print '.',
            status = parser.get_status(show.sid)
            all_eps = parser.get_all_eps(show.sid)
            db.change_status(conf, show.sid, status)
            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."