def run(self): try: xbmc.log( '[ script.module.fenomscrapers ] CheckSettingsFile Service Starting...', LOGNOTICE) window.clearProperty('fenomscrapers_settings') profile_dir = control.dataPath if not control.existsPath(profile_dir): success = control.makeDirs(profile_dir) if success: xbmc.log('%s : created successfully' % profile_dir, LOGNOTICE) else: xbmc.log('%s : already exists' % profile_dir, LOGNOTICE) settings_xml = control.joinPath(profile_dir, 'settings.xml') if not control.existsPath(settings_xml): control.setSetting('module.provider', 'Fenomscrapers') xbmc.log('%s : created successfully' % settings_xml, LOGNOTICE) else: xbmc.log('%s : already exists' % settings_xml, LOGNOTICE) return xbmc.log( '[ script.module.fenomscrapers ] Finished CheckSettingsFile Service', LOGNOTICE) except: import traceback traceback.print_exc()
def undesirablesSelect(): chosen = getSetting('undesirables.choice').replace(' ', '').split(',') try: preselect = [UNDESIRABLES.index(i) for i in chosen] except: preselect = [UNDESIRABLES.index(i) for i in UNDESIRABLES] choices = multiselectDialog(UNDESIRABLES, preselect=preselect) if not choices: return choices = [UNDESIRABLES[i] for i in choices] setSetting('undesirables.choice', ','.join(choices))
def get_api(self): try: user_name = getSetting('furk.user_name') user_pass = getSetting('furk.user_pass') api_key = getSetting('furk.api') if api_key == '': if user_name == '' or user_pass == '': return s = requests.Session() link = (self.base_link + self.login_link % (user_name, user_pass)) p = s.post(link) p = jsloads(p.text) if p['status'] == 'ok': api_key = p['api_key'] setSetting('furk.api', api_key) else: pass return api_key except: source_utils.scraper_error('FURK')
elif action == 'ShowChangelog': from fenomscrapers.modules import changelog changelog.get() elif action == 'ShowHelp': from fenomscrapers.help import help help.get(name) elif action == "Defaults": sourceList = [] sourceList = sources_fenomscrapers.all_providers for i in sourceList: source_setting = 'provider.' + i value = control.getSettingDefault(source_setting) control.setSetting(source_setting, value) elif action == "toggleAll": sourceList = [] sourceList = sources_fenomscrapers.all_providers for i in sourceList: source_setting = 'provider.' + i control.setSetting(source_setting, params['setting']) elif action == "toggleAllHosters": sourceList = [] sourceList = sources_fenomscrapers.hoster_providers for i in sourceList: source_setting = 'provider.' + i control.setSetting(source_setting, params['setting'])