def rescrape_with_disabled(db_type, meta, season=None, episode=None): from caches.providers_cache import ExternalProvidersCache from modules.sources import Sources from modules.nav_utils import clear_cache kodi_utils.show_busy_dialog() deleted = ExternalProvidersCache().delete_cache_single( db_type, str(meta['tmdb_id'])) if not deleted: return kodi_utils.notification(32574) clear_cache('internal_scrapers', silent=True) if db_type == 'movie': play_params = { 'mode': 'play_media', 'vid_type': 'movie', 'tmdb_id': meta['tmdb_id'], 'disabled_ignored': 'true', 'prescrape': 'false' } else: play_params = { 'mode': 'play_media', 'vid_type': 'episode', 'tmdb_id': meta['tmdb_id'], 'tvshowtitle': meta['rootname'], 'season': season, 'episode': episode, 'disabled_ignored': 'true', 'prescrape': 'false' } kodi_utils.hide_busy_dialog() Sources().playback_prep(play_params)
def next_episode_context_choice(): from modules.utils import selection_dialog from modules.nav_utils import toggle_setting, build_url params = dict(parse_qsl(sys.argv[2].replace('?', ''))) content_settings = settings.nextep_content_settings() display_settings = settings.nextep_display_settings() airdate_replacement = [('%d-%m-%Y', 'Day-Month-Year'), ('%Y-%m-%d', 'Year-Month-Day'), ('%m-%d-%Y', 'Month-Day-Year')] sort_type_status = ('Recently Watched', 'Airdate', 'Title')[content_settings['sort_type']] sort_order_status = ('Descending', 'Ascending')[content_settings['sort_order']] toggle_sort_order_SETTING = ('nextep.sort_order', ('0' if sort_order_status == 'Ascending' else '1')) cache_to_disk_status = str(content_settings['cache_to_disk']) toggle_cache_to_disk_SETTING = ('nextep.cache_to_disk', ('true' if cache_to_disk_status == 'False' else 'false')) unaired_status = str(content_settings['include_unaired']) toggle_unaired_SETTING = ('nextep.include_unaired', ('true' if unaired_status == 'False' else 'false')) unwatched_status = str(content_settings['include_unwatched']) toggle_unwatched_SETTING = ('nextep.include_unwatched', ('true' if unwatched_status == 'False' else 'false')) airdate_status = str(display_settings['include_airdate']) toggle_airdate_SETTING = ('nextep.include_airdate', ('true' if airdate_status == 'False' else 'false')) airdate_format = settings.nextep_airdate_format() airdate_format_status = [ airdate_format.replace(i[0], i[1]) for i in airdate_replacement if i[0] == airdate_format ][0] airdate_highlight = display_settings['airdate_colour'].capitalize() unaired_highlight = display_settings['unaired_colour'].capitalize() unwatched_highlight = display_settings['unwatched_colour'].capitalize() choices = [ ('MANAGE IN PROGRESS SHOWS', 'manage_in_progress'), ('SORT TYPE: [I]Currently [B]%s[/B][/I]' % sort_type_status, 'Sort Type'), ('SORT ORDER: [I]Currently [B]%s[/B][/I]' % sort_order_status, 'toggle_cache_to_disk'), ('CACHE TO DISK: [I]Currently [B]%s[/B][/I]' % cache_to_disk_status, 'toggle_cache_to_disk'), ('INCLUDE UNAIRED EPISODES: [I]Currently [B]%s[/B][/I]' % unaired_status, 'toggle_unaired'), ('INCLUDE WATCHLIST/UNWATCHED TV: [I]Currently [B]%s[/B][/I]' % unwatched_status, 'toggle_unwatched'), ('INCLUDE AIRDATE: [I]Currently [B]%s[/B][/I]' % airdate_status, 'toggle_airdate'), ('AIRDATE FORMAT: [I]Currently [B]%s[/B][/I]' % airdate_format_status, 'Airdate Format'), ('AIRDATE HIGHLIGHT: [I]Currently [B]%s[/B][/I]' % airdate_highlight, 'Airdate'), ('UNAIRED HIGHLIGHT: [I]Currently [B]%s[/B][/I]' % unaired_highlight, 'Unaired'), ('UNWATCHED HIGHLIGHT: [I]Currently [B]%s[/B][/I]' % unwatched_highlight, 'Unwatched') ] if settings.watched_indicators() == 0: choices.append(('MANAGE UNWATCHED TV SHOWS', 'manage_unwatched')) if settings.watched_indicators() in (1, 2): choices.append(('CLEAR TRAKT CACHE', 'clear_cache')) string = 'Next Episode Manager' dialog_list = [i[0] for i in choices] function_list = [i[1] for i in choices] choice = selection_dialog(dialog_list, function_list, string) if not choice: return if choice in ('toggle_sort_order', 'toggle_cache_to_disk', 'toggle_unaired', 'toggle_unwatched', 'toggle_airdate'): setting = eval(choice + '_SETTING') toggle_setting(setting[0], setting[1]) elif choice == 'clear_cache': from modules.nav_utils import clear_cache clear_cache('trakt') else: if choice in ('manage_in_progress', 'manage_unwatched'): xbmc.executebuiltin('Container.Update(%s)' % build_url({ 'mode': 'build_next_episode_manager', 'action': choice })) return elif choice in ('Airdate', 'Unaired', 'Unwatched'): function = next_episode_color_choice else: function = next_episode_options_choice function(choice) xbmc.executebuiltin("Container.Refresh") xbmc.executebuiltin('RunPlugin(%s)' % build_url({'mode': 'next_episode_context_choice'}))
def clear_scrapers_cache(silent=False): from modules.nav_utils import clear_cache for item in ('internal_scrapers', 'external_scrapers'): clear_cache(item, silent=True) if not silent: kodi_utils.notification(32576)
set_quality() elif mode == 'playback_menu': from modules.utils import playback_menu playback_menu(params.get('from_results', None), params.get('suggestion', None), params.get('list_name', None), params.get('play_params', None)) elif mode == 'playback_kodi_library_menu': from modules.utils import playback_kodi_library_menu playback_kodi_library_menu() elif mode == 'refresh_cached_data': from modules.nav_utils import refresh_cached_data refresh_cached_data() elif mode == 'clear_cache': from modules.nav_utils import clear_cache clear_cache(params.get('cache')) elif mode == 'clear_all_cache': from modules.nav_utils import clear_all_cache clear_all_cache() elif mode == 'show_text': from modules.nav_utils import show_text show_text() elif mode == 'movie_reviews': from modules.nav_utils import movie_reviews movie_reviews(params['tmdb_id'], params['rootname'], params['poster']) elif mode == 'settings_layout': from modules.nav_utils import settings_layout settings_layout(params.get('settings_type', None)) elif mode == 'download_file': from modules.nav_utils import show_busy_dialog from modules import downloader
def options_menu(params, meta=None): def _builder(): for item in listing: line1 = item[0] line2 = item[1] if line2 == '': line2 = line1 yield {'line1': line1, 'line2': line2} content = params.get('content', None) if not content: content = kodi_utils.container_content()[:-1] season = params.get('season', None) episode = params.get('episode', None) if not meta: function = metadata.movie_meta if content == 'movie' else metadata.tvshow_meta meta_user_info = metadata.retrieve_user_info() meta = function('tmdb_id', params['tmdb_id'], meta_user_info) watched_indicators = settings.watched_indicators() on_str, off_str, currently_str, open_str, settings_str = ls(32090), ls( 32027), ls(32598), ls(32641), ls(32247) autoplay_status, autoplay_toggle, quality_setting = (on_str, 'false', 'autoplay_quality_%s' % content) if settings.auto_play(content) \ else (off_str, 'true', 'results_quality_%s' % content) quality_filter_setting = 'autoplay_quality_%s' % content if autoplay_status == on_str else 'results_quality_%s' % content autoplay_next_status, autoplay_next_toggle = ( on_str, 'false') if settings.autoplay_next_episode() else (off_str, 'true') results_xml_style_status = get_setting('results.xml_style', 'Default') results_filter_ignore_status, results_filter_ignore_toggle = ( on_str, 'false') if settings.ignore_results_filter() else (off_str, 'true') results_sorting_status = get_setting('results.sort_order_display').replace( '$ADDON[plugin.video.fen 32582]', ls(32582)) current_results_highlights_action = get_setting('highlight.type') results_highlights_status = ls( 32240) if current_results_highlights_action == '0' else ls( 32583) if current_results_highlights_action == '1' else ls(32241) current_subs_action = get_setting('subtitles.subs_action') current_subs_action_status = 'Auto' if current_subs_action == '0' else ls( 32193) if current_subs_action == '1' else off_str active_internal_scrapers = [ i.replace('_', '') for i in settings.active_internal_scrapers() ] current_scrapers_status = ', '.join([ i for i in active_internal_scrapers ]) if len(active_internal_scrapers) > 0 else 'N/A' current_quality_status = ', '.join( settings.quality_filter(quality_setting)) uncached_torrents_status, uncached_torrents_toggle = ( on_str, 'false') if settings.display_uncached_torrents() else (off_str, 'true') listing = [] base_str1 = '%s%s' base_str2 = '%s: [B]%s[/B]' % (currently_str, '%s') if content in ('movie', 'episode'): multi_line = 'true' listing += [(ls(32014), '', 'clear_and_rescrape')] listing += [(ls(32006), '', 'rescrape_with_disabled')] listing += [(ls(32135), '', 'scrape_with_custom_values')] listing += [(base_str1 % (ls(32175), ' (%s)' % content), base_str2 % autoplay_status, 'toggle_autoplay')] if autoplay_status == on_str and content == 'episode': listing += [ (base_str1 % (ls(32178), ''), base_str2 % autoplay_next_status, 'toggle_autoplay_next') ] listing += [(base_str1 % (ls(32105), ' (%s)' % content), base_str2 % current_quality_status, 'set_quality')] listing += [(base_str1 % ('', '%s %s' % (ls(32055), ls(32533))), base_str2 % current_scrapers_status, 'enable_scrapers')] if autoplay_status == off_str: listing += [(base_str1 % ('', ls(32140)), base_str2 % results_xml_style_status, 'set_results_xml_display')] listing += [ (base_str1 % ('', ls(32151)), base_str2 % results_sorting_status, 'set_results_sorting') ] listing += [(base_str1 % ('', ls(32138)), base_str2 % results_highlights_status, 'set_results_highlights')] listing += [(base_str1 % ('', ls(32686)), base_str2 % results_filter_ignore_status, 'set_results_filter_ignore')] listing += [(base_str1 % ('', ls(32183)), base_str2 % current_subs_action_status, 'set_subs_action') ] if 'external' in active_internal_scrapers: listing += [(base_str1 % ('', ls(32160)), base_str2 % uncached_torrents_status, 'toggle_torrents_display_uncached')] else: multi_line = 'false' listing += [(ls(32046), '', 'extras_lists_choice')] if content in ('movie', 'tvshow') and meta: listing += [ (ls(32604) % (ls(32028) if meta['mediatype'] == 'movie' else ls(32029)), '', 'clear_media_cache') ] if watched_indicators == 1: listing += [(ls(32497) % ls(32037), '', 'clear_trakt_cache')] if content in ('movie', 'episode'): listing += [(ls(32637), '', 'clear_scrapers_cache')] listing += [('%s %s' % (ls(32118), ls(32513)), '', 'open_external_scrapers_manager')] listing += [('%s %s %s' % (open_str, ls(32522), settings_str), '', 'open_scraper_settings')] listing += [('%s %s %s' % (open_str, ls(32036), settings_str), '', 'open_fen_settings')] listing += [(ls(32640), '', 'save_and_exit')] list_items = list(_builder()) heading = ls(32646).replace('[B]', '').replace('[/B]', '') kwargs = { 'items': json.dumps(list_items), 'heading': heading, 'enumerate': 'false', 'multi_choice': 'false', 'multi_line': multi_line } choice = kodi_utils.select_dialog([i[2] for i in listing], **kwargs) if choice in (None, 'save_and_exit'): return elif choice == 'clear_and_rescrape': return clear_and_rescrape(content, meta, season, episode) elif choice == 'rescrape_with_disabled': return rescrape_with_disabled(content, meta, season, episode) elif choice == 'scrape_with_custom_values': return scrape_with_custom_values(content, meta, season, episode) elif choice == 'toggle_autoplay': set_setting('auto_play_%s' % content, autoplay_toggle) elif choice == 'toggle_autoplay_next': set_setting('autoplay_next_episode', autoplay_next_toggle) elif choice == 'enable_scrapers': enable_scrapers_choice() elif choice == 'set_results_xml_display': results_layout_choice() elif choice == 'set_results_sorting': results_sorting_choice() elif choice == 'set_results_filter_ignore': set_setting('ignore_results_filter', results_filter_ignore_toggle) elif choice == 'set_results_highlights': results_highlights_choice() elif choice == 'set_quality': set_quality_choice(quality_filter_setting) elif choice == 'set_subs_action': set_subtitle_choice() elif choice == 'extras_lists_choice': extras_lists_choice() elif choice == 'clear_media_cache': return refresh_cached_data(meta['mediatype'], 'tmdb_id', meta['tmdb_id'], meta['tvdb_id'], settings.get_language()) elif choice == 'toggle_torrents_display_uncached': set_setting('torrent.display.uncached', uncached_torrents_toggle) elif choice == 'clear_trakt_cache': return clear_cache('trakt') elif choice == 'clear_scrapers_cache': return clear_scrapers_cache() elif choice == 'open_external_scrapers_manager': return external_scrapers_manager() elif choice == 'open_scraper_settings': return kodi_utils.execute_builtin( 'Addon.OpenSettings(script.module.fenomscrapers)') elif choice == 'open_fen_settings': return open_settings('0.0') if choice == 'clear_trakt_cache' and content in ('movie', 'tvshow', 'season', 'episode'): kodi_utils.execute_builtin('Container.Refresh') kodi_utils.show_busy_dialog() kodi_utils.sleep(200) kodi_utils.hide_busy_dialog() options_menu(params, meta=meta)
def routing(argv2): params = dict(parse_qsl(argv2.replace('?',''))) mode = params.get('mode', 'navigator.main') if 'navigator.' in mode: from indexers.navigator import Navigator exec('Navigator(params).%s()' % mode.split('.')[1]) elif 'discover.' in mode: if mode in ('discover.remove_from_history', 'discover.remove_all_history'): if mode == 'discover.remove_from_history': from indexers.discover import remove_from_history params['silent'] = False remove_from_history(params) elif mode == 'discover.remove_all_history': from indexers.discover import remove_all_history params['silent'] = True remove_all_history(params) else: from indexers.discover import Discover exec('Discover(params).%s()' % mode.split('.')[1]) elif 'furk.' in mode: if mode == 'furk.browse_packs': from modules.sources import Sources Sources().furkPacks(params['file_name'], params['file_id'], params['highlight']) elif mode == 'furk.add_to_files': from indexers.furk import add_to_files add_to_files(params['item_id']) elif mode == 'furk.remove_from_files': from indexers.furk import remove_from_files remove_from_files(params['item_id']) elif mode == 'furk.remove_from_downloads': from indexers.furk import remove_from_downloads remove_from_downloads(params['item_id']) elif mode == 'furk.remove_from_files': from indexers.furk import add_uncached_file add_uncached_file(params['id']) elif mode == 'furk.myfiles_protect_unprotect': from indexers.furk import myfiles_protect_unprotect myfiles_protect_unprotect(params['action'], params['name'], params['item_id']) elif mode == 'furk.browse_audio_album': from indexers.furk import browse_audio_album browse_audio_album(params.get('t_file', None), params.get('item_path', None)) else: from modules.utils import manual_function_import function = manual_function_import('indexers.furk', mode.split('.')[-1]) function(params) elif 'easynews.' in mode: from modules.utils import manual_function_import function = manual_function_import('indexers.easynews', mode.split('.')[-1]) function(params) elif '_play' in mode or 'play_' in mode and not 'autoplay' in mode: if mode == 'play_media': from modules.sources import Sources if 'params' in params: import json params = json.loads(params['params']) Sources().playback_prep(params) elif mode == 'play_display_results': from modules.sources import Sources Sources().display_results() elif mode == 'play_file': from modules.sources import Sources Sources().play_file(params['title'], params['source']) elif mode == 'media_play': from modules.player import FenPlayer FenPlayer().run(params.get('url', None), params.get('media_type', None)) elif mode == 'play_fetch_random': from modules.random_play import play_fetch_random play_fetch_random(params['tmdb_id']) elif 'choice' in mode: from indexers import dialogs if mode == 'scraper_color_choice': dialogs.scraper_color_choice(params['setting']) elif mode == 'scraper_dialog_color_choice': dialogs.scraper_dialog_color_choice(params['setting']) elif mode == 'scraper_quality_color_choice': dialogs.scraper_quality_color_choice(params['setting']) elif mode == 'imdb_images_choice': dialogs.imdb_images_choice(params['imdb_id'], params['rootname']) elif mode == 'set_quality_choice': dialogs.set_quality_choice(params['quality_setting']) elif mode == 'results_sorting_choice': dialogs.results_sorting_choice() elif mode == 'results_layout_choice': dialogs.results_layout_choice() elif mode == 'options_menu_choice': dialogs.options_menu(params) elif mode == 'meta_language_choice': dialogs.meta_language_choice() elif mode == 'extras_menu_choice': dialogs.extras_menu(params) elif mode == 'enable_scrapers_choice': dialogs.enable_scrapers_choice() elif mode == 'favorites_choice': dialogs.favorites_choice(params) elif mode == 'trakt_manager_choice': dialogs.trakt_manager_choice(params) elif mode == 'folder_scraper_manager_choice': dialogs.folder_scraper_manager_choice() elif mode == 'set_language_filter_choice': dialogs.set_language_filter_choice(params['filter_setting']) elif mode == 'media_extra_info_choice': dialogs.media_extra_info(params['media_type'], params['meta']) elif mode == 'extras_lists_choice': dialogs.extras_lists_choice() elif 'trakt.' in mode or 'trakt_' in mode: if mode == 'get_trakt_my_calendar': from indexers.episodes_single import get_trakt_my_calendar get_trakt_my_calendar(params) elif 'trakt.list' in mode: from modules.utils import manual_function_import function = manual_function_import('indexers.trakt_lists', mode.split('.')[-1]) function(params) elif 'trakt.' in mode: from modules.utils import manual_function_import function = manual_function_import('apis.trakt_api', mode.split('.')[-1]) function(params) else: from apis.trakt_api import hide_unhide_trakt_items hide_unhide_trakt_items(params['action'], params['media_type'], params['media_id'], params['section']) elif 'build' in mode: if mode == 'build_movie_list': from indexers.movies import Movies Movies(params).fetch_list() elif mode == 'build_tvshow_list': from indexers.tvshows import TVShows TVShows(params).fetch_list() elif mode == 'build_season_list': from indexers.seasons import build_season_list build_season_list(params) elif mode == 'build_episode_list': from indexers.episodes import build_episode_list build_episode_list(params) elif mode == 'build_next_episode': from indexers.episodes_single import build_next_episode build_next_episode() elif mode == 'build_in_progress_episode': from indexers.episodes_single import build_in_progress_episode build_in_progress_episode() elif mode == 'build_navigate_to_page': from modules.nav_utils import build_navigate_to_page build_navigate_to_page(params) elif mode == 'build_next_episode_manager': from indexers.next_episode import build_next_episode_manager build_next_episode_manager(params) elif mode == 'imdb_build_user_lists': from indexers.imdb import imdb_build_user_lists imdb_build_user_lists(params.get('db_type')) elif mode == 'build_popular_people': from indexers.people import popular_people popular_people() elif mode == 'imdb_build_keyword_results': from indexers.imdb import imdb_build_keyword_results imdb_build_keyword_results(params['db_type'], params['query']) elif 'favourites' in mode: from modules.favourites import Favourites exec('Favourites(params).%s()' % mode) elif 'watched_unwatched' in mode: if mode == 'mark_as_watched_unwatched_episode': from modules.watched_status import mark_as_watched_unwatched_episode mark_as_watched_unwatched_episode(params) elif mode == 'mark_as_watched_unwatched_season': from modules.watched_status import mark_as_watched_unwatched_season mark_as_watched_unwatched_season(params) elif mode == 'mark_as_watched_unwatched_tvshow': from modules.watched_status import mark_as_watched_unwatched_tvshow mark_as_watched_unwatched_tvshow(params) elif mode == 'mark_as_watched_unwatched_movie': from modules.watched_status import mark_as_watched_unwatched_movie mark_as_watched_unwatched_movie(params) elif mode == 'watched_unwatched_erase_bookmark': from modules.watched_status import erase_bookmark erase_bookmark(params.get('db_type'), params.get('tmdb_id'), params.get('season', ''), params.get('episode', ''), params.get('refresh', 'false')) elif 'myaccounts' in mode: action = mode.split('.')[1] if action == 'open': from modules.nav_utils import open_MyAccounts open_MyAccounts(params) else: from modules.nav_utils import sync_MyAccounts sync_MyAccounts() elif 'toggle' in mode: if mode == 'toggle_jump_to': from modules.nav_utils import toggle_jump_to toggle_jump_to() elif mode == 'toggle_provider': from modules.utils import toggle_provider toggle_provider() elif mode == 'toggle_language_invoker': from modules.nav_utils import toggle_language_invoker toggle_language_invoker() elif 'history' in mode: if mode == 'search_history': from indexers.history import search_history search_history(params) elif mode == 'clear_search_history': from modules.history import clear_search_history clear_search_history() elif mode == 'remove_from_history': from modules.history import remove_from_search_history remove_from_search_history(params) elif 'real_debrid' in mode: if mode == 'real_debrid.rd_torrent_cloud': from indexers.real_debrid import rd_torrent_cloud rd_torrent_cloud() if mode == 'real_debrid.rd_downloads': from indexers.real_debrid import rd_downloads rd_downloads() elif mode == 'real_debrid.browse_rd_cloud': from indexers.real_debrid import browse_rd_cloud browse_rd_cloud(params['id']) elif mode == 'real_debrid.resolve_rd': from indexers.real_debrid import resolve_rd resolve_rd(params) elif mode == 'real_debrid.rd_account_info': from indexers.real_debrid import rd_account_info rd_account_info() elif mode == 'real_debrid.delete': from indexers.real_debrid import rd_delete rd_delete(params.get('id'), params.get('cache_type')) elif mode == 'real_debrid.delete_download_link': from indexers.real_debrid import delete_download_link delete_download_link(params['download_id']) elif 'premiumize' in mode: if mode == 'premiumize.pm_torrent_cloud': from indexers.premiumize import pm_torrent_cloud pm_torrent_cloud(params.get('id', None), params.get('folder_name', None)) elif mode == 'premiumize.pm_transfers': from indexers.premiumize import pm_transfers pm_transfers() elif mode == 'premiumize.pm_account_info': from indexers.premiumize import pm_account_info pm_account_info() elif mode == 'premiumize.rename': from indexers.premiumize import pm_rename pm_rename(params.get('file_type'), params.get('id'), params.get('name')) elif mode == 'premiumize.delete': from indexers.premiumize import pm_delete pm_delete(params.get('file_type'), params.get('id')) elif 'alldebrid' in mode: if mode == 'alldebrid.ad_torrent_cloud': from indexers.alldebrid import ad_torrent_cloud ad_torrent_cloud(params.get('id', None)) elif mode == 'alldebrid.browse_ad_cloud': from indexers.alldebrid import browse_ad_cloud browse_ad_cloud(params['folder']) elif mode == 'alldebrid.resolve_ad': from indexers.alldebrid import resolve_ad resolve_ad(params) elif mode == 'alldebrid.ad_account_info': from indexers.alldebrid import ad_account_info ad_account_info() elif 'people_search' in mode: from indexers import people if 'person_data_dialog' in mode: people.person_data_dialog(params) elif '.search' in mode: people.person_search(params.get('actor_name', None)) elif '_settings' in mode: if mode == 'open_settings': from modules.nav_utils import open_settings open_settings(params.get('query')) elif mode == 'clean_settings': from modules.nav_utils import clean_settings clean_settings() elif mode == 'erase_all_settings': from modules.nav_utils import erase_all_settings erase_all_settings() elif mode == 'external_settings': from modules.nav_utils import open_settings open_settings(params.get('query', '0.0'), params.get('ext_addon')) elif mode == 'clear_settings_window_properties': from modules.kodi_utils import clear_settings_window_properties clear_settings_window_properties() elif '_cache' in mode: from modules import nav_utils if mode == 'clear_cache': nav_utils.clear_cache(params.get('cache')) elif mode == 'clear_all_cache': nav_utils.clear_all_cache() elif '_image' in mode: from indexers.images import Images Images().run(params) elif 'service_functions' in mode: from services import service_functions exec('service_functions.%s().run()' % mode.split('.')[1]) elif '_text' in mode: if mode == 'show_text': from modules.kodi_utils import show_text show_text(params.get('heading'), params.get('text', None), params.get('file', None), params.get('font_size', 'small')) elif mode == 'show_text_media': from modules.kodi_utils import show_text_media show_text(params.get('heading'), params.get('text', None), params.get('file', None), params.get('meta'), {}) elif '_view' in mode: from modules import kodi_utils if mode == 'choose_view': kodi_utils.choose_view(params['view_type'], params.get('content', '')) elif mode == 'set_view': kodi_utils.set_view(params['view_type']) ##EXTRA modes## elif mode == 'manual_add_magnet_to_cloud': from modules.debrid import manual_add_magnet_to_cloud manual_add_magnet_to_cloud(params) elif mode == 'debrid.browse_packs': from modules.sources import Sources Sources().debridPacks(params['provider'], params['name'], params['magnet_url'], params['info_hash'], params['highlight']) elif mode == 'get_search_term': from modules.nav_utils import get_search_term get_search_term(params) elif mode == 'link_folders': from modules.nav_utils import link_folders link_folders(params['service'], params['folder_name'], params['action']) elif mode == 'downloader': from modules.downloader import runner runner(params) elif mode == 'clean_databases': from caches import clean_databases clean_databases() elif mode == 'refresh_artwork': from modules.nav_utils import refresh_artwork refresh_artwork()
def playback_menu(from_results=False, suggestion=None, list_name=None, play_params=None): try: from urlparse import parse_qsl except ImportError: from urllib.parse import parse_qsl from modules.nav_utils import toggle_setting, build_url, open_settings, clear_cache, cached_page_clear, clear_and_rescrape from modules import settings params = dict(parse_qsl(sys.argv[2].replace('?',''))) content = xbmc.getInfoLabel('Container.Content') if not content: content = params.get('content', None) from_results = params.get('from_results', from_results) suggestion = params.get('suggestion', suggestion) list_name = params.get('list_name', list_name) play_params = params.get('play_params', play_params) autoplay_status, autoplay_toggle, filter_setting = ('On', 'false', 'autoplay_quality') if settings.auto_play() else ('Off', 'true', 'results_quality') quality_filter_setting = 'autoplay' if autoplay_status == 'On' else 'results' autoplay_next_status, autoplay_next_toggle = ('On', 'false') if settings.autoplay_next_episode() else ('Off', 'true') display_mode = settings.display_mode() display_mode_status = 'Directory' if display_mode == 0 else 'Very Simple Directory' if display_mode == 1 else 'Dialog' autoplay_hevc_status = settings.autoplay_hevc() current_subs_action_status = __addon__.getSetting('subtitles.subs_action') active_scrapers = [i.replace('-', '').replace('folder', 'f') for i in settings.active_scrapers()] current_scrapers_status = ', '.join([i.upper()[:3] for i in active_scrapers]) if len(active_scrapers) > 0 else 'NONE' current_filter_status = ', '.join(settings.quality_filter(filter_setting)) indicators_status, indicators_toggle = ('Trakt', '0') if settings.watched_indicators() in (1, 2) else ('Fen', '1') cached_torrents_status, cached_torrents_toggle = ('On', 'false') if __addon__.getSetting('torrent.check.cache') =='true' else ('Off', 'true') uncached_torrents_status, uncached_torrents_toggle = ('On', 'false') if __addon__.getSetting('torrent.display.uncached') =='true' else ('Off', 'true') active_cloud_store = settings.active_store_torrent_to_cloud() active_cloud_store_status = ', '.join([i[1] for i in active_cloud_store]) if len(active_cloud_store) > 0 else 'NONE' furk_easy_suggestion = params.get('suggestion', '') listing = [] if play_params: listing += [('RESCRAPE & SELECT SOURCE', 'rescrape_select')] listing += [('AUTOPLAY: [I]Currently [B]%s[/B][/I]' % autoplay_status, 'toggle_autoplay')] if autoplay_status == 'On': listing += [('HEVC AUTOPLAY FILTER: [I]Currently [B]%s[/B][/I]' % autoplay_hevc_status, 'set_autoplay_hevc')] listing += [('AUTOPLAY NEXT EPISODE: [I]Currently [B]%s[/B][/I]' % autoplay_next_status, 'toggle_autoplay_next')] listing += [('ENABLE SCRAPERS: [I]Currently [B]%s[/B][/I]' % current_scrapers_status, 'enable_scrapers')] if autoplay_status == 'Off': listing += [('DISPLAY MODE: [I]Currently [B]%s[/B][/I]' % display_mode_status, 'set_display_mode')] listing += [('QUALITY FILTERS: [I]Currently [B]%s[/B][/I]' % current_filter_status, 'set_filters')] listing += [('DOWNLOAD SUBTITLES: [I]Currently [B]%s[/B][/I]' % current_subs_action_status, 'set_subs_action')] if settings.cache_page(): listing += [('CLEAR RESUME BROWSING PAGE', 'clear_cache_page')] listing += [('SWITCH INDICATOR PROVIDER: [I]Currently [B]%s[/B][/I]' % indicators_status, 'toggle_indicators')] if 'external' in active_scrapers: listing += [('CHECK FOR CACHED TORRENTS: [I]Currently [B]%s[/B][/I]' % cached_torrents_status, 'toggle_cached_torrents')] if cached_torrents_status == 'On': listing += [(' - SHOW UNCACHED TORRENTS: [I]Currently [B]%s[/B][/I]' % uncached_torrents_status, 'toggle_torrents_display_uncached')] listing += [(' - ADD TORRENTS TO CLOUD: [I]Currently [B]%s[/B][/I]' % active_cloud_store_status, 'set_active_cloud_store')] if content in ('movies', 'episodes', 'movie', 'episode'): listing += [('FURK/EASYNEWS SEARCH: [B][I]%s[/I][/B]' % furk_easy_suggestion, 'search_directly')] if settings.watched_indicators() in (1,2): listing += [('CLEAR TRAKT CACHE', 'clear_trakt_cache')] listing += [('EXTERNAL SCRAPERS MANAGER', 'open_external_scrapers_manager')] listing += [('OPEN TIKI META SETTINGS', 'open_meta_settings')] listing += [('OPEN OPENSCRAPERS SETTINGS', 'open_scraper_settings')] listing += [('OPEN FEN SETTINGS', 'open_fen_settings')] listing += [('[B]SAVE SETTINGS AND EXIT[/B]', 'save_and_exit')] xbmc.sleep(500) choice = selection_dialog([i[0] for i in listing], [i[1] for i in listing], 'Fen Options...') if choice == 'rescrape_select': return clear_and_rescrape(play_params) elif choice == 'toggle_autoplay': toggle_setting('auto_play', autoplay_toggle) elif choice == 'set_autoplay_hevc': set_autoplay_hevc() elif choice == 'toggle_autoplay_next': toggle_setting('autoplay_next_episode', autoplay_next_toggle) elif choice == 'enable_scrapers': enable_scrapers() elif choice == 'set_display_mode': set_display_mode() elif choice == 'set_filters': set_quality(quality_filter_setting) elif choice == 'set_subs_action': set_subtitle_action() elif choice == 'clear_cache_page': cached_page_clear(action=list_name) elif choice == 'toggle_indicators': toggle_setting('watched_indicators', indicators_toggle) elif choice == 'toggle_cached_torrents': toggle_setting('torrent.check.cache', cached_torrents_toggle) elif choice == 'toggle_torrents_display_uncached': toggle_setting('torrent.display.uncached', uncached_torrents_toggle) elif choice == 'set_active_cloud_store': set_active_cloud_store(active_cloud_store) elif choice == 'search_directly': furk_easynews_direct_search_choice(suggestion, from_results, list_name) elif choice == 'clear_trakt_cache': clear_cache('trakt') elif choice == 'open_external_scrapers_manager': external_scrapers_manager() elif choice == 'open_meta_settings': xbmc.executebuiltin('Addon.OpenSettings(script.module.tikimeta)') elif choice == 'open_scraper_settings': xbmc.executebuiltin('Addon.OpenSettings(script.module.openscrapers)') elif choice == 'open_fen_settings': open_settings('0.0') if choice in ('clear_cache_page', 'toggle_indicators', 'clear_trakt_cache') and content in ('movies', 'tvshows', 'seasons', 'episodes'): xbmc.executebuiltin('Container.Refresh') if choice in (None, 'rescrape_select', 'save_and_exit', 'clear_cache_page', 'toggle_indicators', 'clear_trakt_cache', 'search_directly', 'open_meta_settings', 'open_scraper_settings', 'open_fen_settings', 'open_external_scrapers_manager'): return xbmc.executebuiltin('RunPlugin(%s)' % build_url({'mode': 'playback_menu', 'from_results': from_results, 'suggestion': suggestion, 'list_name': list_name, 'play_params': play_params}))