Esempio n. 1
0
    def get_season_info_markup(self, season):
        if season == '0':
            name = _('Special')
        else:
            name = _('Season %s') % season
        info = self.get_episodes_info(season)
        episodes = info['episodes']
        episodes_to_watch = info['episodes_to_watch']
        next_episode = info['next_episode']
        season_info = ''
        color = get_color(constants.SECONDARY_TEXT_COLOR)
        if not episodes_to_watch:
            if episodes:
                name = '<small><span foreground="%s">%s</span></small>' % \
                        (get_color(constants.SECONDARY_TEXT_COLOR), name)
                season_info = _('Completely watched')
        else:
            number_episodes_to_watch = len(episodes_to_watch)
            season_info = gettext.ngettext('%s episode not watched',
                                           '%s episodes not watched',
                                           number_episodes_to_watch) \
                                           % number_episodes_to_watch
            if next_episode:
                next_air_date = next_episode.air_date
                if next_air_date:
                    season_info += ' | ' + _('<i>Next episode:</i> %s, %s') % \
                                   (next_episode.episode_number, \
                                    next_episode.get_air_date_text())
                else:
		    season_info += ' | ' + _('<i>Next episode:</i> %s') % \
                                   next_episode.episode_number
                if next_episode.already_aired():
                    color = get_color(constants.ACTIVE_TEXT_COLOR)
        return '<b>%s</b>\n<small><span foreground="%s">%s</span></small>' % \
               (name, color, season_info)
Esempio n. 2
0
 def get_info_markup(self, info = None):
     seasons = len(self.get_seasons())
     if seasons:
         color = get_color(constants.SECONDARY_TEXT_COLOR)
         episodes_info = info or self.get_episodes_info()
         episodes_to_watch = episodes_info['episodes_to_watch']
         next_episode = episodes_info['next_episode']
         if next_episode and next_episode.already_aired():
             color = get_color(constants.ACTIVE_TEXT_COLOR)
         show_info = '\n<small><span foreground="%s">' % color
         show_info += gettext.ngettext('%s season', '%s seasons', seasons) \
                      % seasons
         if self.is_completely_watched():
             show_info += ' | ' + _('Completely watched')
         else:
             if episodes_to_watch:
                 n_episodes_to_watch = len(episodes_to_watch)
                 show_info += ' | ' + gettext.ngettext('%s episode not watched',
                                                       '%s episodes not watched',
                                                       n_episodes_to_watch) \
                                                       % n_episodes_to_watch
                 if next_episode:
                     next_air_date = next_episode.air_date
                     if next_air_date:
                         show_info += ' | ' + _('<i>Next episode:</i> %s, %s') % \
                                      (next_episode.get_episode_show_number(), \
                                      next_episode.get_air_date_text())
                     else:
                         show_info += ' | ' + _('<i>Next episode:</i> %s') % \
                                      next_episode.get_episode_show_number()
                     if next_episode.already_aired():
                         color = get_color(constants.ACTIVE_TEXT_COLOR)
             else:
                 show_info += ' | ' + _('No episodes to watch')
         show_info += '</span></small>'
     else:
         show_info = ''
     return '<b>%s</b>' % saxutils.escape(self.name) + show_info
Esempio n. 3
0
 def get_info_markup(self):
     color = get_color(constants.SECONDARY_TEXT_COLOR)
     if not self.watched and self.already_aired():
         color = get_color(constants.ACTIVE_TEXT_COLOR)
     return '<span foreground="%s">%s\n%s</span>' % \
            (color, saxutils.escape(str(self)), self.get_air_date_text())