def toggle_jump_to(): from resources.lib.modules.nav_utils import toggle_setting, notification from resources.lib.modules.settings import nav_jump_use_alphabet use_alphabet = nav_jump_use_alphabet() (setting, new_action) = ('0', 'PAGE') if use_alphabet == True else ('1', 'ALPHABET') toggle_setting(setting_id='nav_jump', setting_value=setting, refresh=True) notification('Jump To Action Switched to [B]%s[/B]' % new_action)
def next_episode_context_choice(): from urlparse import parse_qsl from resources.lib.modules.utils import selection_dialog from resources.lib.modules.nav_utils import toggle_setting, build_url import settings params = dict(parse_qsl(sys.argv[2].replace('?',''))) content_settings = settings.nextep_content_settings() display_settings = settings.nextep_display_settings() force_display_status = str(display_settings['force_display']) toggle_force_display_SETTING = ('nextep.force_display', ('true' if force_display_status == 'False' else 'false')) 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')) 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_sort_order'), ('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'), ('ATTEMPT TO MAKE SKIN HONOR FULL LABEL: [I]Currently [B]%s[/B][/I]' % force_display_status, 'toggle_force_display'), ('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_unaired', 'toggle_unwatched', 'toggle_airdate', 'toggle_force_display'): setting = eval(choice + '_SETTING') toggle_setting(setting[0], setting[1]) elif choice == 'clear_cache': from resources.lib.modules.nav_utils import clear_cache clear_cache('trakt') else: if choice in ('manage_in_progress', 'manage_unwatched'): xbmc.executebuiltin('XBMC.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 scraper_dialog_color_choice(): from urlparse import parse_qsl from resources.lib.modules.nav_utils import open_settings, toggle_setting params = dict(parse_qsl(sys.argv[2].replace('?',''))) setting, setting_nav = ('int_dialog_highlight', '3.6') if params['setting'] == 'internal' else ('ext_dialog_highlight', '3.7') dialog = 'Please Choose Color for Internal Scrapers Progress Dialog Highlight' chosen_color = color_chooser(dialog) if chosen_color: toggle_setting(setting, chosen_color) open_settings(setting_nav)
def set_autoplay_quality(action=False, source='autoplay_quality'): from urlparse import parse_qsl params = dict(parse_qsl(sys.argv[2].replace('?',''))) action = params.get('action', action) open_setting = ('4.2') string = 'Please Choose Autoplay Filters' dl = ['Include SD', 'Include 720p', 'Include 1080p', 'Include 4K'] fl = ['SD', '720p', '1080p', '4K'] preselect = [fl.index(i) for i in __addon__.getSetting('autoplay_quality').split(', ')] filters = multiselect_dialog(string, dl, fl, preselect) if not filters: return from resources.lib.modules.nav_utils import toggle_setting toggle_setting('autoplay_quality', ', '.join(filters)) if not action: from resources.lib.modules.nav_utils import open_settings open_settings(open_setting)
def scraper_color_choice(): from urlparse import parse_qsl from resources.lib.modules.nav_utils import open_settings, toggle_setting params = dict(parse_qsl(sys.argv[2].replace('?',''))) choices = [('local', 'provider.local_colour'), ('downloads', 'provider.downloads_colour'), ('furk', 'provider.furk_colour'), ('easynews', 'provider.easynews_colour'), ('premium', 'prem.identify'), ('torrent', 'torrent.identify')] title, setting = [(i[0], i[1]) for i in choices if i[0] == params.get('setting')][0] setting_nav = ('3.15') if setting == 'provider.furk_colour' else ('3.21') if setting == 'provider.easynews_colour' else \ ('3.28') if setting == 'provider.local_colour' else ('3.35') if setting == 'provider.downloads_colour' else \ ('3.51') if setting == 'prem.identify' else ('3.52') dialog = 'Please Choose Color for %s Results Highlight' % title.capitalize() chosen_color = color_chooser(dialog, no_color=True) if chosen_color: toggle_setting(setting, chosen_color) open_settings(setting_nav)
def enable_scrapers(): from settings import active_scrapers from resources.lib.modules.nav_utils import toggle_setting scrapers = ['local', 'downloads', 'furk', 'easynews', 'external'] preselect = [scrapers.index(i) for i in active_scrapers()] scrapers_dialog = [i.capitalize() for i in scrapers] scraper_choice = multiselect_dialog('Choose Fen Scrapers', scrapers_dialog, scrapers , preselect=preselect) if scraper_choice < 0: return return [toggle_setting('provider.%s' % i, ('true' if i in scraper_choice else 'false')) for i in scrapers]
def set_results_quality(from_results=False, action=False): from urlparse import parse_qsl params = dict(parse_qsl(sys.argv[2].replace('?',''))) from_results = True if 'from_results' in params else False action = params.get('action', action) open_setting = ('4.4') string = 'Please Choose Result Filters:' dl = ['Include SD', 'Include 720p', 'Include 1080p', 'Include 4K'] fl = ['SD', '720p', '1080p', '4K'] preselect = [fl.index(i) for i in __addon__.getSetting('results_quality').split(', ')] filters = multiselect_dialog(string, dl, fl, preselect) if not filters: return from resources.lib.modules.nav_utils import toggle_setting toggle_setting('results_quality', ', '.join(filters)) if from_results == True: xbmc.executebuiltin('Container.Refresh') if not action: from resources.lib.modules.nav_utils import open_settings open_settings(open_setting) else: pass
elif mode == 'mark_movie_as_watched_unwatched': from resources.lib.modules.indicators_bookmarks import mark_movie_as_watched_unwatched mark_movie_as_watched_unwatched() elif mode == 'mark_tv_show_as_watched_unwatched': from resources.lib.modules.indicators_bookmarks import mark_tv_show_as_watched_unwatched mark_tv_show_as_watched_unwatched() elif mode == 'mark_season_as_watched_unwatched': from resources.lib.modules.indicators_bookmarks import mark_season_as_watched_unwatched mark_season_as_watched_unwatched() elif mode == 'mark_episode_as_watched_unwatched': from resources.lib.modules.indicators_bookmarks import mark_episode_as_watched_unwatched mark_episode_as_watched_unwatched() elif 'toggle' in mode: if mode == 'toggle_setting': from resources.lib.modules.nav_utils import toggle_setting toggle_setting() elif mode == 'toggle_jump_to': from resources.lib.modules.utils import toggle_jump_to toggle_jump_to() elif mode == 'toggle_provider': from resources.lib.modules.utils import toggle_provider toggle_provider() elif 'history' in mode: if mode == 'search_history': from resources.lib.modules.history import search_history search_history() elif mode == 'clear_search_history': from resources.lib.modules.history import clear_search_history clear_search_history() elif mode == 'remove_from_history': from resources.lib.modules.history import remove_from_history
def playback_menu(from_results=False, suggestion=None): from urlparse import parse_qsl from resources.lib.modules.nav_utils import toggle_setting, build_url, open_settings, clear_cache from resources.lib.modules import settings content = xbmc.getInfoLabel('Container.Content') params = dict(parse_qsl(sys.argv[2].replace('?',''))) from_results = params.get('from_results', from_results) suggestion = params.get('suggestion', suggestion) autoplay_status, autoplay_toggle, filter_setting = ('On', 'false', 'autoplay_quality') if settings.auto_play() else ('Off', 'true', 'results_quality') autoplay_next_status, autoplay_next_toggle = ('On', 'false') if settings.autoplay_next_episode() else ('Off', 'true') results_display_status, results_display_toggle = ('Dialog', '0') if settings.use_dialog() else ('Directory', '1') prefer_hevc_status, prefer_hevc_toggle = ('On', 'false') if settings.prefer_hevc() else ('Off', 'true') auto_resolve_status, auto_resolve_toggle = ('On', 'false') if settings.auto_resolve() else ('Off', 'true') active_scrapers = settings.active_scrapers() current_scrapers_status = ', '.join([i.capitalize() for i in active_scrapers]) if len(active_scrapers) >= 1 else 'None Active' 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') string = 'Please choose Fen Setting to Change...' listing = [('AUTOPLAY: [I]Currently [B]%s[/B][/I]' % autoplay_status, 'toggle_autoplay')] if autoplay_status == 'On': listing += [('PREFER HEVC IN AUTOPLAY: [I]Currently [B]%s[/B][/I]' % prefer_hevc_status, 'toggle_prefer_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 RESULTS: [I]Currently [B]%s[/B][/I]' % results_display_status, 'toggle_display_results')] listing += [('AUTO RESOLVE FURK PACKS: [I]Currently [B]%s[/B][/I]' % auto_resolve_status, 'toggle_auto_resolve')] listing += [('QUALITY FILTERS: [I]Currently [B]%s[/B][/I]' % current_filter_status, 'set_filters')] listing += [('SWITCH INDICATOR PROVIDER: [I]Currently [B]%s[/B][/I]' % indicators_status, 'toggle_indicators')] if settings.watched_indicators() in (1,2): listing += [('CLEAR TRAKT CACHE', 'clear_trakt_cache')] if content in ('movies', 'episodes'): listing += [('FURK/EASYNEWS SEARCH: [B][I]%s[/I][/B]' % params.get('suggestion', ''), 'search_directly')] listing += [('OPEN EXTERNAL SCRAPER 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], string) if choice == 'toggle_autoplay': toggle_setting('auto_play', autoplay_toggle) elif choice == 'toggle_prefer_hevc': toggle_setting('prefer_hevc', prefer_hevc_toggle) elif choice == 'toggle_autoplay_next': toggle_setting('autoplay_next_episode', autoplay_next_toggle) elif choice == 'enable_scrapers': enable_scrapers() elif choice == 'toggle_display_results': toggle_setting('use_dialog', results_display_toggle) elif choice == 'toggle_auto_resolve': toggle_setting('auto_resolve', auto_resolve_toggle) elif choice == 'set_filters': set_autoplay_quality(action=True) if autoplay_status == 'On' else set_results_quality(action=True) elif choice == 'toggle_indicators': toggle_setting('watched_indicators', indicators_toggle) elif choice == 'clear_trakt_cache': clear_cache('trakt') elif choice == 'search_directly': furk_easynews_direct_search_choice(suggestion, from_results) elif choice == 'open_scraper_settings': xbmc.executebuiltin('Addon.OpenSettings(%s)' % 'script.module.tikiscrapers') elif choice == 'open_fen_settings': open_settings('0.0') if choice in ('toggle_indicators', 'clear_trakt_cache') and content in ('movies', 'tvshows', 'seasons', 'episodes'): xbmc.executebuiltin('Container.Refresh') if choice in (None, 'save_and_exit', 'toggle_indicators', 'clear_trakt_cache', 'search_directly', 'open_scraper_settings', 'open_fen_settings'): return xbmc.executebuiltin('RunPlugin(%s)' % build_url({'mode': 'playback_menu', 'from_results': from_results, 'suggestion': suggestion}))
def unaired_episode_color_choice(): from resources.lib.modules.nav_utils import open_settings, toggle_setting dialog = 'Please Choose Color for Unaired Episodes' chosen_color = color_chooser(dialog, no_color=True) if chosen_color: toggle_setting('unaired_episode_colour', chosen_color) open_settings('0.4')