예제 #1
0
def set_quality_choice(quality_setting):
    include = ls(32188)
    dl = [
        '%s SD' % include,
        '%s 720p' % include,
        '%s 1080p' % include,
        '%s 4K' % include
    ]
    fl = ['SD', '720p', '1080p', '4K']
    try:
        preselect = [
            fl.index(i) for i in get_setting(quality_setting).split(', ')
        ]
    except:
        preselect = []
    list_items = [{'line1': item} for item in dl]
    kwargs = {
        'items': json.dumps(list_items),
        'heading': 'Fen',
        'enumerate': 'false',
        'multi_choice': 'true',
        'multi_line': 'false',
        'preselect': preselect
    }
    choice = kodi_utils.select_dialog(fl, **kwargs)
    if choice is None: return
    if choice == []:
        kodi_utils.ok_dialog(text=32574, top_space=True)
        return set_quality_choice(quality_setting)
    set_setting(quality_setting, ', '.join(choice))
예제 #2
0
def set_language_filter_choice(filter_setting):
    from modules.meta_lists import language_choices
    lang_choices = language_choices
    lang_choices.pop('None')
    dl = list(lang_choices.keys())
    fl = list(lang_choices.values())
    try:
        preselect = [
            fl.index(i) for i in get_setting(filter_setting).split(', ')
        ]
    except:
        preselect = []
    list_items = [{'line1': item} for item in dl]
    kwargs = {
        'items': json.dumps(list_items),
        'heading': 'Fen',
        'enumerate': 'false',
        'multi_choice': 'true',
        'multi_line': 'false',
        'preselect': preselect
    }
    choice = kodi_utils.select_dialog(fl, **kwargs)
    if choice == None: return
    if choice == []:
        return set_setting(filter_setting, 'eng')
    set_setting(filter_setting, ', '.join(choice))
예제 #3
0
def toggle_language_invoker():
    import xml.etree.ElementTree as ET
    from modules.utils import gen_file_hash
    kodi_utils.close_all_dialog()
    kodi_utils.sleep(100)
    addon_dir = kodi_utils.translate_path(
        'special://home/addons/plugin.video.fen')
    addon_xml = os.path.join(addon_dir, 'addon.xml')
    tree = ET.parse(addon_xml)
    root = tree.getroot()
    try:
        current_value = [
            str(i.text) for i in root.iter('reuselanguageinvoker')
        ][0]
    except:
        return
    current_setting = get_setting('reuse_language_invoker')
    new_value = 'false' if current_value == 'true' else 'true'
    if not kodi_utils.confirm_dialog(
            text=ls(33018) % (current_value.upper(), new_value.upper())):
        return
    if new_value == 'true':
        if not kodi_utils.confirm_dialog(text=33019, top_space=True): return
    for item in root.iter('reuselanguageinvoker'):
        item.text = new_value
        hash_start = gen_file_hash(addon_xml)
        tree.write(addon_xml)
        hash_end = gen_file_hash(addon_xml)
        if hash_start != hash_end:
            set_setting('reuse_language_invoker', new_value)
        else:
            return kodi_utils.ok_dialog(text=32574, top_space=True)
    kodi_utils.ok_dialog(text=33020, top_space=True)
    kodi_utils.execute_builtin('LoadProfile(%s)' %
                               kodi_utils.get_infolabel('system.profilename'))
예제 #4
0
def toggle_jump_to():
    from modules.settings import nav_jump_use_alphabet
    (setting,
     new_action) = ('0', ls(32022)) if nav_jump_use_alphabet() else ('1',
                                                                     ls(32023))
    set_setting('nav_jump', setting)
    kodi_utils.execute_builtin('Container.Refresh')
    kodi_utils.notification(ls(32851) % new_action)
예제 #5
0
def scraper_color_choice(setting):
    choices = [('furk', 'provider.furk_colour'),
               ('easynews', 'provider.easynews_colour'),
               ('debrid_cloud', 'provider.debrid_cloud_colour'),
               ('folders', 'provider.folders_colour'),
               ('hoster', 'hoster.identify'), ('torrent', 'torrent.identify'),
               ('rd', 'provider.rd_colour'), ('pm', 'provider.pm_colour'),
               ('ad', 'provider.ad_colour'), ('free', 'provider.free_colour')]
    setting = [i[1] for i in choices if i[0] == setting][0]
    chosen_color = color_chooser('Fen')
    if chosen_color: set_setting(setting, chosen_color)
예제 #6
0
 def auth_loop(self):
     kodi_utils.sleep(5000)
     response = requests.get(self.check_url, timeout=self.timeout).json()
     response = response['data']
     if 'error' in response:
         self.token = 'failed'
         return kodi_utils.ok_dialog(text=32574, top_space=True)
     if response['activated']:
         try:
             kodi_utils.progressDialog.close()
             self.token = str(response['apikey'])
             set_setting('ad.token', self.token)
         except:
             self.token = 'failed'
             self.break_auth_loop = True
             return kodi_utils.ok_dialog(text=32574, top_space=True)
     return
예제 #7
0
 def run(self):
     time = datetime.datetime.now()
     current_time = self._get_timestamp(time)
     due_clean = int(get_setting('database.maintenance.due', '0'))
     if current_time >= due_clean:
         logger('FEN', 'Database Maintenance Service Starting')
         monitor.waitForAbort(10.0)
         try:
             clean_databases(current_time,
                             database_check=False,
                             silent=True)
         except:
             pass
         next_clean = str(
             int(self._get_timestamp(time + datetime.timedelta(days=3))))
         set_setting('database.maintenance.due', next_clean)
         return logger('FEN', 'Database Maintenance Service Finished')
예제 #8
0
 def refreshToken(self):
     try:
         url = auth_url + 'token'
         data = {
             'client_id': self.client_ID,
             'client_secret': self.secret,
             'code': self.refresh,
             'grant_type': 'http://oauth.net/grant_type/device/1.0'
         }
         response = requests.post(url, data=data).json()
         self.token = response['access_token']
         self.refresh = response['refresh_token']
         set_setting('rd.token', self.token)
         set_setting('rd.refresh', self.refresh)
         return True
     except:
         return False
예제 #9
0
 def auth_loop(self):
     sleep(1000 * self.auth_step)
     url = 'client_id=%s&code=%s' % (self.client_ID, self.device_code)
     url = auth_url + credentials_url % url
     response = json.loads(requests.get(url, timeout=self.timeout).text)
     if 'error' in response:
         return
     try:
         progressDialog.close()
         set_setting('rd.client_id', response['client_id'])
         set_setting('rd.secret', response['client_secret'])
         self.secret = response['client_secret']
         self.client_ID = response['client_id']
     except:
         ok_dialog(text=ls(32574), top_space=True)
         self.break_auth_loop = True
     return
예제 #10
0
 def auth(self):
     self.token = ''
     line = '%s[CR]%s[CR]%s'
     data = {'response_type': 'device_code', 'client_id': self.client_id}
     url = 'https://www.premiumize.me/token'
     response = self._post(url, data)
     progressDialog.create('Fen', '')
     progressDialog.update(
         -1,
         line % (ls(32517), ls(32700) % response.get('verification_uri'),
                 ls(32701) % response.get('user_code')))
     self.device_code = response['device_code']
     while self.token == '':
         self.auth_loop()
     if self.token is None: return
     account_info = self.account_info()
     set_setting('pm.account_id', str(account_info['customer_id']))
     ok_dialog(text=32576, top_space=True)
예제 #11
0
def meta_language_choice():
    from modules.meta_lists import meta_languages
    langs = meta_languages
    list_items = [{'line1': i['name']} for i in langs]
    kwargs = {
        'items': json.dumps(list_items),
        'heading': ls(32145),
        'enumerate': 'false',
        'multi_choice': 'false',
        'multi_line': 'false'
    }
    list_choose = kodi_utils.select_dialog(langs, **kwargs)
    if list_choose == None: return None
    from caches.meta_cache import delete_meta_cache
    chosen_language = list_choose['iso']
    chosen_language_display = list_choose['name']
    set_setting('meta_language', chosen_language)
    set_setting('meta_language_display', chosen_language_display)
    delete_meta_cache(silent=True)
예제 #12
0
def results_sorting_choice():
    quality, provider, size = ls(32241), ls(32583), ls(32584)
    choices = [('%s, %s, %s' % (quality, provider, size), '0'),
               ('%s, %s, %s' % (quality, size, provider), '1'),
               ('%s, %s, %s' % (provider, quality, size), '2'),
               ('%s, %s, %s' % (provider, size, quality), '3'),
               ('%s, %s, %s' % (size, quality, provider), '4'),
               ('%s, %s, %s' % (size, provider, quality), '5')]
    list_items = [{'line1': item[0]} for item in choices]
    kwargs = {
        'items': json.dumps(list_items),
        'heading': 'Fen',
        'enumerate': 'false',
        'multi_choice': 'false',
        'multi_line': 'false'
    }
    choice = kodi_utils.select_dialog(choices, **kwargs)
    if choice:
        set_setting('results.sort_order_display', choice[0])
        set_setting('results.sort_order', choice[1])
예제 #13
0
 def get_api(self):
     try:
         api_key = get_setting('furk_api_key')
         if not api_key:
             user_name, user_pass = get_setting('furk_login'), get_setting(
                 'furk_password')
             if not user_name or not user_pass: return
             url = base_url + login_url % (user_name, user_pass)
             result = requests.post(url, timeout=self.timeout)
             result = p.json()
             if self.check_status(result):
                 from modules.kodi_utils import ext_addon
                 api_key = result['api_key']
                 set_setting('furk_api_key', api_key)
                 ext_addon('script.module.myaccounts').setSetting(
                     'furk.api.key', api_key)
             else:
                 pass
         return api_key
     except:
         pass
예제 #14
0
def set_subtitle_choice():
    choices = ((ls(32192), '0'), (ls(32193), '1'), (ls(32027), '2'))
    list_items = [{'line1': item[0]} for item in choices]
    kwargs = {
        'items': json.dumps(list_items),
        'heading': 'Fen',
        'enumerate': 'false',
        'multi_choice': 'false',
        'multi_line': 'false'
    }
    choice = kodi_utils.select_dialog([i[1] for i in choices], **kwargs)
    if choice: return set_setting('subtitles.subs_action', choice)
예제 #15
0
def results_highlights_choice():
    choices = ((ls(32240), '0'), (ls(32583), '1'), (ls(32241), '2'))
    list_items = [{'line1': item[0]} for item in choices]
    kwargs = {
        'items': json.dumps(list_items),
        'heading': 'Fen',
        'enumerate': 'false',
        'multi_choice': 'false',
        'multi_line': 'false'
    }
    choice = kodi_utils.select_dialog([i[1] for i in choices], **kwargs)
    if choice: return set_setting('highlight.type', choice)
예제 #16
0
 def auth_loop(self):
     if progressDialog.iscanceled():
         progressDialog.close()
         return
     sleep(5000)
     url = 'https://www.premiumize.me/token'
     data = {
         'grant_type': 'device_code',
         'client_id': self.client_id,
         'code': self.device_code
     }
     response = self._post(url, data)
     if 'error' in response:
         return
     try:
         progressDialog.close()
         self.token = str(response['access_token'])
         set_setting('pm.token', self.token)
     except:
         ok_dialog(text=32574, top_space=True)
     return
예제 #17
0
def enable_scrapers_choice():
    scrapers = [
        'external', 'furk', 'easynews', 'rd_cloud', 'pm_cloud', 'ad_cloud',
        'folders'
    ]
    cloud_scrapers = {
        'rd_cloud': 'rd.enabled',
        'pm_cloud': 'pm.enabled',
        'ad_cloud': 'ad.enabled'
    }
    scraper_names = [
        ls(32118).upper(),
        ls(32069).upper(),
        ls(32070).upper(),
        ls(32098).upper(),
        ls(32097).upper(),
        ls(32099).upper(),
        ls(32108).upper()
    ]
    preselect = [
        scrapers.index(i) for i in settings.active_internal_scrapers()
    ]
    list_items = [{'line1': item} for item in scraper_names]
    kwargs = {
        'items': json.dumps(list_items),
        'heading': 'Fen',
        'enumerate': 'false',
        'multi_choice': 'true',
        'multi_line': 'false',
        'preselect': preselect
    }
    choice = kodi_utils.select_dialog(scrapers, **kwargs)
    if choice is None: return
    for i in scrapers:
        set_setting('provider.%s' % i, ('true' if i in choice else 'false'))
        if i in cloud_scrapers and i in choice:
            set_setting(cloud_scrapers[i], 'true')
예제 #18
0
 def auth(self):
     self.token = ''
     url = base_url + 'pin/get?agent=%s' % user_agent
     response = requests.get(url, timeout=self.timeout).json()
     response = response['data']
     line = '%s[CR]%s[CR]%s'
     kodi_utils.progressDialog.create('Fen', '')
     kodi_utils.progressDialog.update(
         -1, line % (ls(32517), ls(32700) % response.get('base_url'),
                     ls(32701) % response.get('pin')))
     self.check_url = response.get('check_url')
     kodi_utils.sleep(2000)
     while not self.token:
         if self.break_auth_loop:
             break
         if kodi_utils.progressDialog.iscanceled():
             kodi_utils.progressDialog.close()
             break
         self.auth_loop()
     if self.token in (None, '', 'failed'): return
     kodi_utils.sleep(2000)
     account_info = self._get('user')
     set_setting('ad.account_id', str(account_info['user']['username']))
     kodi_utils.ok_dialog(text=32576, top_space=True)
예제 #19
0
 def _exit_save_settings():
     for folder_no in range(1, 6):
         set_setting(name_setting % folder_no,
                     _get_property(name_setting % folder_no))
         set_setting(movie_dir_setting % folder_no,
                     _get_property(movie_dir_setting % folder_no))
         set_setting(tvshow_dir_setting % folder_no,
                     _get_property(tvshow_dir_setting % folder_no))
         _clear_property('fen_%s' % name_setting % folder_no)
         _clear_property('fen_%s' % movie_dir_setting % folder_no)
         _clear_property('fen_%s' % tvshow_dir_setting % folder_no)
예제 #20
0
 def get_token(self):
     if self.secret == '': return
     data = {
         'client_id': self.client_ID,
         'client_secret': self.secret,
         'code': self.device_code,
         'grant_type': 'http://oauth.net/grant_type/device/1.0'
     }
     url = '%stoken' % auth_url
     response = requests.post(url, data=data, timeout=self.timeout).text
     response = json.loads(response)
     self.token = response['access_token']
     self.refresh = response['refresh_token']
     username = self.account_info()['username']
     set_setting('rd.token', self.token)
     set_setting('rd.auth', self.token)
     set_setting('rd.refresh', self.refresh)
     set_setting('rd.username', username)
     ok_dialog(text=32576, top_space=True)
예제 #21
0
def scraper_dialog_color_choice(setting):
    setting = 'int_dialog_highlight' if setting == 'internal' else 'ext_dialog_highlight'
    chosen_color = color_chooser('Fen')
    if chosen_color: set_setting(setting, chosen_color)
예제 #22
0
 def revoke_auth(self):
     set_setting('ad.account_id', '')
     set_setting('ad.token', '')
     kodi_utils.ok_dialog(heading=32063,
                          text='%s %s' % (ls(32059), ls(32576)))
예제 #23
0
 def revoke_auth(self):
     set_setting('pm.account_id', '')
     set_setting('pm.token', '')
     ok_dialog(heading=32061, text='%s %s' % (ls(32059), ls(32576)))
예제 #24
0
def extras_lists_choice():
    screenshots_directory = 'special://home/addons/script.tikiart/resources/screenshots/extras/%s'
    fl = [
        2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062
    ]
    dl = [{
        'name':
        ls(32503),
        'image':
        kodi_utils.translate_path(screenshots_directory %
                                  '001_recommended.jpg')
    }, {
        'name':
        ls(32607),
        'image':
        kodi_utils.translate_path(screenshots_directory % '002_reviews.jpg')
    }, {
        'name':
        ls(32984),
        'image':
        kodi_utils.translate_path(screenshots_directory % '003_trivia.jpg')
    }, {
        'name':
        ls(32986),
        'image':
        kodi_utils.translate_path(screenshots_directory % '004_blunders.jpg')
    }, {
        'name':
        ls(32989),
        'image':
        kodi_utils.translate_path(screenshots_directory %
                                  '005_parentalguide.jpg')
    }, {
        'name':
        ls(33032),
        'image':
        kodi_utils.translate_path(screenshots_directory % '006_videos.jpg')
    }, {
        'name':
        ls(32616),
        'image':
        kodi_utils.translate_path(screenshots_directory % '007_posters.jpg')
    }, {
        'name':
        ls(32617),
        'image':
        kodi_utils.translate_path(screenshots_directory % '008_fanart.jpg')
    }, {
        'name':
        '%s %s' % (ls(32612), ls(32543)),
        'image':
        kodi_utils.translate_path(screenshots_directory %
                                  '009_morefromyear.jpg')
    }, {
        'name':
        '%s %s' % (ls(32612), ls(32470)),
        'image':
        kodi_utils.translate_path(screenshots_directory %
                                  '010_morefromgenres.jpg')
    }, {
        'name':
        '%s %s' % (ls(32612), ls(32480)),
        'image':
        kodi_utils.translate_path(screenshots_directory %
                                  '011_morefromnetwork.jpg')
    }, {
        'name':
        '%s %s' % (ls(32612), ls(32499)),
        'image':
        kodi_utils.translate_path(screenshots_directory % '012_collection.jpg')
    }]
    try:
        preselect = [fl.index(i) for i in settings.extras_enabled_lists()]
    except:
        preselect = []
    kwargs = {'items': json.dumps(dl), 'preselect': preselect}
    selection = open_window(('windows.extras', 'ExtrasChooser'),
                            'extras_chooser.xml', **kwargs)
    if selection == []: return set_setting('extras.enabled_lists', 'noop')
    elif selection == None: return
    selection = [str(fl[i]) for i in selection]
    set_setting('extras.enabled_lists', ','.join(selection))
예제 #25
0
def sync_MyAccounts(silent=False):
    import myaccounts
    from modules.settings_reader import get_setting, set_setting
    all_acct = myaccounts.getAll()
    try:
        trakt_acct = all_acct.get('trakt')
        if trakt_acct.get('username') not in ('', None):
            if get_setting('trakt_user') != trakt_acct.get('username'):
                set_setting('trakt_indicators_active', 'true')
                set_setting('watched_indicators', '1')
                kodi_utils.set_property('fen_refresh_trakt_info', 'true')
        else:
            set_setting('trakt_indicators_active', 'false')
            set_setting('watched_indicators', '0')
        set_setting('trakt_user', trakt_acct.get('username'))
    except:
        pass
    try:
        fu_acct = all_acct.get('furk')
        set_setting('furk_login', fu_acct.get('username'))
        set_setting('furk_password', fu_acct.get('password'))
        if fu_acct.get('api_key') != '':
            set_setting('furk_api_key', fu_acct.get('api_key'))
        elif get_setting('furk_api_key') != '':
            kodi_utils.ext_addon('script.module.myaccounts').setSetting(
                'furk.api.key', get_setting('furk_api_key'))
    except:
        pass
    try:
        en_acct = all_acct.get('easyNews')
        set_setting('easynews_user', en_acct.get('username'))
        set_setting('easynews_password', en_acct.get('password'))
    except:
        pass
    try:
        tmdb_acct = all_acct.get('tmdb')
        tmdb_key = tmdb_acct.get('api_key')
        if not tmdb_key: tmdb_key = '050ee5c6c85883b200be501c878a2aed'
        set_setting('tmdb_api', tmdb_key)
    except:
        pass
    try:
        fanart_acct = all_acct.get('fanart_tv')
        fanart_key = fanart_acct.get('api_key')
        if not fanart_key: fanart_key = 'fe073550acf157bdb8a4217f215c0882'
        set_setting('fanart_client_key', fanart_key)
    except:
        pass
    try:
        imdb_acct = all_acct.get('imdb')
        set_setting('imdb_user', imdb_acct.get('user'))
    except:
        pass
    try:
        rd_acct = all_acct.get('realdebrid')
        if get_setting('rd.username') != rd_acct.get('username'):
            set_setting('rd.username', rd_acct.get('username'))
            set_setting('rd.client_id', rd_acct.get('client_id'))
            set_setting('rd.refresh', rd_acct.get('refresh'))
            set_setting('rd.secret', rd_acct.get('secret'))
            set_setting('rd.token', rd_acct.get('token'))
            set_setting('rd.auth', rd_acct.get('token'))
    except:
        pass
    try:
        pm_acct = all_acct.get('premiumize')
        set_setting('pm.token', pm_acct.get('token'))
        if get_setting('pm.account_id') != pm_acct.get('username'):
            set_setting('pm.account_id', pm_acct.get('username'))
    except:
        pass
    try:
        ad_acct = all_acct.get('alldebrid')
        set_setting('ad.token', ad_acct.get('token'))
        if get_setting('ad.account_id') != ad_acct.get('username'):
            set_setting('ad.account_id', ad_acct.get('username'))
    except:
        pass
    if not silent: kodi_utils.notification(33030, time=1500)
예제 #26
0
def results_layout_choice():
    screenshots_directory = 'special://home/addons/script.tikiart/resources/screenshots/results/%s'
    xml_choices = [
        ('List Default',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_list.default.jpg')),
        ('List Contrast Default',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_list.contrast.default.jpg')),
        ('List Details',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_list.details.jpg')),
        ('List Contrast Details',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_list.contrast.details.jpg')),
        ('InfoList Default',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_infolist.default.jpg')),
        ('InfoList Contrast Default',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_infolist.contrast.default.jpg')),
        ('InfoList Details',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_infolist.details.jpg')),
        ('InfoList Contrast Details',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_infolist.contrast.details.jpg')),
        ('Rows Default',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_rows.default.jpg')),
        ('Rows Contrast Default',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_rows.contrast.default.jpg')),
        ('Rows Details',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_rows.details.jpg')),
        ('Rows Contrast Details',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_rows.contrast.details.jpg')),
        ('Shift Default',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_shift.default.jpg')),
        ('Shift Contrast Default',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_shift.contrast.default.jpg')),
        ('Shift Details',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_shift.details.jpg')),
        ('Shift Contrast Details',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_shift.contrast.details.jpg')),
        ('Thumb Default',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_thumb.default.jpg')),
        ('Thumb Contrast Default',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_thumb.contrast.default.jpg')),
        ('Thumb Details',
         kodi_utils.translate_path(screenshots_directory %
                                   'source_results_thumb.details.jpg')),
        ('Thumb Contrast Details',
         kodi_utils.translate_path(
             screenshots_directory %
             'source_results_thumb.contrast.details.jpg'))
    ]
    choice = open_window(['windows.sources', 'SourceResultsChooser'],
                         'sources_chooser.xml',
                         xml_choices=xml_choices)
    if choice: set_setting('results.xml_style', choice)
예제 #27
0
 def revoke_auth(self):
     set_setting('rd.auth', '')
     set_setting('rd.client_id', '')
     set_setting('rd.refresh', '')
     set_setting('rd.secret', '')
     set_setting('rd.token', '')
     set_setting('rd.username', '')
     ok_dialog(heading=32054, text='%s %s' % (ls(32059), ls(32576)))
예제 #28
0
def scraper_quality_color_choice(setting):
    chosen_color = color_chooser('Fen')
    if chosen_color: set_setting(setting, chosen_color)
예제 #29
0
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)