예제 #1
0
파일: tui.py 프로젝트: Sakartu/next
 def do_new(self, line=None):
     '''
     A TUI function that lists all the shows for which new eps are available
     '''
     try:
         all_shows = self.get_all_shows()
     except NoShowsException:
         print u'There are no shows!'
     shows = []
     for show in all_shows:
         p = player.build_ep_path(self.conf, show)
         if p:
             shows.append(show)
     if not shows:
         print u'No new eps are available for your shows!'
         return
     print "New eps are on your computer for these shows:"
     print_shows(self.conf, shows)
예제 #2
0
파일: tui.py 프로젝트: Sakartu/next
def print_shows(conf, shows, extended=False):
    '''
    A helper function that prints a list of shows, each with the reached season and ep.
    '''
    new_shows = []
    if extended:
        # find all shows that have a new ep waiting
        for show in shows:
            p = player.build_ep_path(conf, show)
            if p:
                new_shows.append(show)

    max_len = max(map(len, map(lambda x : x.name, shows))) + 3
    print u'{id:3s}  {name:{length}s}  Next ep   {status}'.format(id=u'', name=u'Show Name', length=max_len, status='Status' if extended else '')
    for (i, show) in enumerate(shows):
        print u'{id:3d}. {name:{length}s} {new}s{S:>02d}e{E:>02d}    {status}'.format(
                id=i + 1, name=show.name, length=max_len, new='*' if show in
                new_shows and not show.maybe_finished else ' ', S=show.season,
                E=show.ep, status=show.status if extended else "")