def browse_season(series, season): plugin.set_content('episodes') select_quality = plugin.request.arg('select_quality') series = get_scraper().get_series_cached(series) link = select_torrent_link(series.id, season, "99", select_quality) if not link: return [] torrent = get_torrent(link.url) items = [itemify_file(torrent.file_name, series, season, f) for f in torrent.files] return with_fanart(items)
def browse_library(): plugin.set_content('tvshows') scraper = get_scraper() library = library_items() total = len(library) for batch_ids in batch(library, BATCH_SERIES_COUNT): if abort_requested(): break series = scraper.get_series_bulk(batch_ids) items = [itemify_series(series[i], highlight_library_items=False) for i in batch_ids] plugin.add_items(with_fanart(items), total) plugin.finish(sort_methods=['unsorted', 'label'])
def browse_all_series(): plugin.set_content('tvshows') scraper = get_scraper() all_series_ids = scraper.get_all_series_ids() total = len(all_series_ids) for batch_ids in batch(all_series_ids, BATCH_SERIES_COUNT): if abort_requested(): break series = scraper.get_series_bulk(batch_ids) items = [itemify_series(series[i]) for i in batch_ids] plugin.add_items(with_fanart(items), total) plugin.finish()
def browse_favorites(): plugin.set_content('tvshows') scraper = get_scraper() library = scraper.get_favorite_series() total = len(library) for batch_ids in batch(library, BATCH_SERIES_COUNT): if abort_requested(): break series = scraper.get_series_bulk(batch_ids) items = [itemify_series(series[i]) for i in batch_ids] plugin.add_items(with_fanart(items), total) plugin.finish(sort_methods=['unsorted', 'label'])
def browse_season(series, season): plugin.set_content('episodes') select_quality = plugin.request.arg('select_quality') series = get_scraper().get_series_cached(series) link = select_torrent_link(series.id, season, "99", select_quality) if not link: return [] torrent = get_torrent(link.url) items = [ itemify_file(torrent.file_name, series, season, f) for f in torrent.files ] return with_fanart(items)
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)
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)
def search(): skbd = xbmc.Keyboard() skbd.setHeading(lang(40423)) skbd.doModal() if skbd.isConfirmed(): query = skbd.getText() else: return None plugin.set_content('tvshows') scraper = get_scraper() library = scraper.search_serial(query) total = len(library) for batch_ids in batch(library, BATCH_SERIES_COUNT): if abort_requested(): break series = scraper.get_series_bulk(batch_ids) items = [itemify_series(series[i]) for i in batch_ids] plugin.add_items(with_fanart(items), total) plugin.finish(sort_methods=['unsorted', 'label'])
def browse_series(series_id): plugin.set_content('episodes') scraper = get_scraper() episodes = scraper.get_series_episodes(series_id) items = itemify_episodes(episodes, same_series=True) plugin.finish(items=with_fanart(items), cache_to_disc=False)