Пример #1
0
def episode_label(e, same_series=False):
    """
    :param same_series:
    :type e: Episode
    """
    label = ""
    if not e.is_complete_season:
        label += tf.color(
            "S%02dE%02d " % (e.season_number, int(e.episode_number)), 'blue')
    if e in library_new_episodes():
        label += tf.color("* ", NEW_LIBRARY_ITEM_COLOR)
    if e.series_id in library_items() and not same_series:
        color = LIBRARY_ITEM_COLOR
    else:
        color = 'white'
    if not same_series:
        label += tf.color(e.series_title, color) + " / " + e.episode_title
    else:
        label += tf.color(e.episode_title, color)
    if e.original_title and plugin.get_setting('show-original-title', bool):
        try:
            title = e.original_title.decode("utf-8")
        except:
            title = e.original_title
        label += " / " + title
    return label
Пример #2
0
 def title(self):
   if plugin.get_setting('show-original-title', bool):
     if self.favorited == True:
       return '%s %s' % (tf.color(self.title_en, 'lime'), self.unwatched_episode_count)
     else:
       return '%s %s' % (self.title_en, self.unwatched_episode_count)  
   else:
     if self.favorited == True:
       return '%s %s' % (tf.color(self.title_ru, 'lime'), self.unwatched_episode_count)
     else:
        return '%s %s' % (self.title_ru, self.unwatched_episode_count)
Пример #3
0
 def title(self):
     if plugin.get_setting('show-original-title', bool):
         if self.favorited == True:
             return '%s %s' % (tf.color(
                 self.title_en, 'lime'), self.unwatched_episode_count)
         else:
             return '%s %s' % (self.title_en, self.unwatched_episode_count)
     else:
         if self.favorited == True:
             return '%s %s' % (tf.color(
                 self.title_ru, 'lime'), self.unwatched_episode_count)
         else:
             return '%s %s' % (self.title_ru, self.unwatched_episode_count)
Пример #4
0
def series_label(s, highlight_library_items=True):
    """
    :type s: Series
    """
    if s.id in library_items() and highlight_library_items:
        color = LIBRARY_ITEM_COLOR
    else:
        color = 'white'
    label = tf.color(s.title, color)
    if plugin.get_setting('show-original-title', bool):
        label += " / " + s.original_title
    new_episodes = library_new_episodes().get_by(series_id=s.id)
    if new_episodes:
        label += " (%s)" % tf.color(str(len(new_episodes)), NEW_LIBRARY_ITEM_COLOR)
    return label
Пример #5
0
def series_label(s, highlight_library_items=True):
    """
    :type s: Series
    """
    if s.id in library_items() and highlight_library_items:
        color = LIBRARY_ITEM_COLOR
    else:
        color = 'white'
    label = tf.color(s.title, color)
    if plugin.get_setting('show-original-title', bool):
        label += " / " + s.original_title
    new_episodes = library_new_episodes().get_by(series_id=s.id)
    if new_episodes:
        label += " (%s)" % tf.color(str(len(new_episodes)), NEW_LIBRARY_ITEM_COLOR)
    return label
Пример #6
0
def select_torrent_link(series_id,
                        season_number,
                        episode_number,
                        select_quality=False):
    dom_parser = get_dom_parser()
    links = dom_parser.get_torrent_links(series_id, season_number,
                                         episode_number)

    qualities = sorted(Quality)
    quality = plugin.get_setting('quality', int)

    ordered_links = [
        next((l for l in links if l.quality == q), None) for q in qualities
    ]

    if not quality or select_quality or not ordered_links[quality - 1]:
        filtered_links = [l for l in ordered_links if l]
        if not filtered_links:
            return
        options = [
            "%s / %s" %
            (tf.color(l.quality.localized, 'white'), tf.human_size(l.size))
            for l in filtered_links
        ]
        res = xbmcgui.Dialog().select(plugin.get_string(40400), options)
        if res < 0:
            return
        return filtered_links[res]
    else:
        return ordered_links[quality - 1]
Пример #7
0
def series_label(s, highlight_library_items=True):
    """
    :param highlight_library_items:
    :type s: Series
    """
    label = tf.color(s.title, 'white')
    if int(s.id) in library_items() and highlight_library_items:
        label = tf.color(tf.bold(s.title), LIBRARY_ITEM_COLOR)

    if plugin.get_setting('show-original-title', bool):
        label += " / " + s.original_title
    new_episodes = library_new_episodes().get_by(series_id=s.id)
    if new_episodes:
        label += " (%s)" % tf.color(str(len(new_episodes)),
                                    NEW_LIBRARY_ITEM_COLOR)
    return label
Пример #8
0
  def unwatched_episode_count(self):
    if int(self.total_episodes) == int(self.watched_episodes):
      return ''

    if int(self.total_episodes) == 0:
      return ''

    return ' (%s)' % tf.color(int(self.total_episodes) - int(self.watched_episodes), 'lime')
Пример #9
0
    def unwatched_episode_count(self):
        if int(self.total_episodes) == int(self.watched_episodes):
            return ''

        if int(self.total_episodes) == 0:
            return ''

        return ' (%s)' % tf.color(
            int(self.total_episodes) - int(self.watched_episodes), 'lime')
Пример #10
0
def episode_label(e, same_series=False):
    """
    :type e: Episode
    """
    label = ""
    if not e.is_complete_season:
        label += tf.color("%02d.%s " % (e.season_number, e.episode_number), 'blue')
    if e in library_new_episodes():
        label += tf.color("* ", NEW_LIBRARY_ITEM_COLOR)
    if e.series_id in library_items() and not same_series:
        color = LIBRARY_ITEM_COLOR
    else:
        color = 'white'
    if not same_series:
        label += tf.color(e.series_title, color) + " / " + e.episode_title
    else:
        label += tf.color(e.episode_title, color)
    if e.original_title and plugin.get_setting('show-original-title', bool):
        label += " / " + e.original_title
    return label
Пример #11
0
def index():
    plugin.set_content('episodes')
    skip = plugin.request.arg('skip')
    per_page = plugin.get_setting('per-page', int)
    scraper = get_scraper()
    episodes = scraper.browse_episodes(skip)
    if episodes and not skip:
        check_last_episode(episodes[0])
    check_first_start()
    new_episodes = library_new_episodes()
    new_str = "(%s) " % tf.color(str(
        len(new_episodes)), NEW_LIBRARY_ITEM_COLOR) if new_episodes else ""
    total = len(episodes)
    header = [
        {
            'label': lang(40401),
            'path': plugin.url_for('browse_all_series')
        },
        {
            'label': lang(40407) % new_str,
            'path': plugin.url_for('browse_library'),
            'context_menu': update_library_menu()
        },
    ]
    items = []
    if skip:
        skip_prev = max(skip - per_page, 0)
        total += 1
        items.append({
            'label': lang(34003),
            'path': plugin.request.url_with_params(skip=skip_prev)
        })
    elif header:
        items.extend(header)
        total += len(header)
    plugin.add_items(with_fanart(items), total)
    for batch_res in batch(episodes, BATCH_EPISODES_COUNT):
        if abort_requested():
            break
        items = itemify_episodes(batch_res)
        plugin.add_items(with_fanart(items), total)
    items = []
    if scraper.has_more:
        skip_next = (skip or 0) + per_page
        items.append({
            'label': lang(34004),
            'path': plugin.request.url_with_params(skip=skip_next)
        })
    plugin.finish(items=with_fanart(items),
                  cache_to_disc=False,
                  update_listing=skip is not None)
Пример #12
0
def select_torrent_link(series, season, episode, force=False):
    scraper = get_scraper()
    links = scraper.get_torrent_links(series, season, episode)
    qualities = sorted(Quality)
    quality = plugin.get_setting('quality', int)
    ordered_links = [next((l for l in links if l.quality == q), None) for q in qualities]
    if not quality or force or not ordered_links[quality - 1]:
        filtered_links = [l for l in ordered_links if l]
        if not filtered_links:
            return
        options = ["%s / %s" % (tf.color(l.quality.localized, 'white'), tf.human_size(l.size)) for l in filtered_links]
        res = xbmcgui.Dialog().select(lang(40400), options)
        if res < 0:
            return
        return filtered_links[res]
    else:
        return ordered_links[quality - 1]
Пример #13
0
def index():
    plugin.set_content('episodes')
    skip = plugin.request.arg('skip')
    per_page = plugin.get_setting('per-page', int)
    scraper = get_scraper()
    episodes = scraper.browse_episodes(skip)
    if episodes and not skip:
        check_last_episode(episodes[0])
    check_first_start()
    new_episodes = library_new_episodes()
    new_str = "(%s) " % tf.color(str(len(new_episodes)), NEW_LIBRARY_ITEM_COLOR) if new_episodes else ""
    total = len(episodes)
    header = [
        {'label': lang(40401), 'path': plugin.url_for('browse_all_series')},
        {'label': lang(40407) % new_str, 'path': plugin.url_for('browse_library'),
         'context_menu': update_library_menu()},
    ]
    items = []
    if skip:
        skip_prev = max(skip - per_page, 0)
        total += 1
        items.append({
            'label': lang(34003),
            'path': plugin.request.url_with_params(skip=skip_prev)
        })
    elif header:
        items.extend(header)
        total += len(header)
    plugin.add_items(with_fanart(items), total)
    for batch_res in batch(episodes, BATCH_EPISODES_COUNT):
        if abort_requested():
            break
        items = itemify_episodes(batch_res)
        plugin.add_items(with_fanart(items), total)
    items = []
    if scraper.has_more:
        skip_next = (skip or 0) + per_page
        items.append({
            'label': lang(34004),
            'path': plugin.request.url_with_params(skip=skip_next)
        })
    plugin.finish(items=with_fanart(items),
                  cache_to_disc=False,
                  update_listing=skip is not None)
Пример #14
0
 def list_title(self):
   if self.watched:
     return '%s.  %s' % (tf.color(self.series_title, 'white'), tf.color(self.title, 'grey'))
   else:
     return '%s.  %s' % (tf.color(self.series_title, 'white'), tf.color(self.title, 'lime'))
Пример #15
0
 def list_title(self):
   if self.watched:
     return self.title
   else:
     return tf.color(self.title, 'lime')