def toggle_episode_watched(series_id, season, episode): xbmc.executebuiltin(actions.toggle_watched()) if plugin.get_setting('sync_mark_watch', bool): scraper = get_scraper() scraper.api.mark_watched(series_id, season, episode, mode='on') if series_id in library_items(): library_new_episodes().remove_by(series_id, season, episode)
def play_episode(series, season, episode): select_quality = plugin.request.arg('select_quality') link = select_torrent_link(series, season, episode, select_quality) if not link: return torrent = get_torrent(link.url) library_new_episodes().remove_by(series, season, episode) play_torrent(torrent)
def remove_from_library(series_id): items = library_items() scraper = get_scraper() if series_id in items: items.remove(series_id) if plugin.get_setting('sync_add_remove_favorite', bool): scraper.api.favorite(series_id) library_new_episodes().remove_by(series_id=series_id) plugin.set_setting('update-library', True) xbmc.executebuiltin(actions.refresh())
def play_episode(series, season, episode): select_quality = plugin.request.arg('select_quality') link = select_torrent_link(series, season, episode, select_quality) if not link: return torrent = get_torrent(link.url) library_new_episodes().remove_by(series, season, episode) play_torrent(torrent, episode) if plugin.get_setting('sync_mark_watch', bool): scraper = get_scraper() scraper.api.mark_watched(series, season, episode, force_mode='on')
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 mark_series_watched(series_id): xbmc.executebuiltin(actions.toggle_watched()) if series_id in library_items(): library_new_episodes().remove_by(series_id)
def remove_from_library(series_id): items = library_items() if series_id in items: items.remove(series_id) library_new_episodes().remove_by(series_id=series_id) plugin.set_setting('update-library', True)