def save_autologin(self, pathitems): """Save autologin data""" try: g.settings_monitor_suspended(True) g.ADDON.setSetting('autologin_user', self.params['autologin_user']) g.ADDON.setSetting('autologin_id', pathitems[1]) g.ADDON.setSetting('autologin_enable', 'true') g.settings_monitor_suspended(False) except (KeyError, IndexError): common.error('Cannot save autologin - invalid params') g.CACHE.invalidate() common.refresh_container()
def toggle_adult_pin(self, pathitems=None): # pylint: disable=no-member, unused-argument """Toggle adult PIN verification""" pin = ui.ask_for_pin() if pin is None: return if api.verify_pin(pin): current_setting = { 'true': True, 'false': False }.get(g.ADDON.getSetting('adultpin_enable').lower()) g.settings_monitor_suspended(True) g.ADDON.setSetting('adultpin_enable', str(not current_setting)) g.settings_monitor_suspended(False) g.flush_settings() ui.show_notification( common.get_local_string(30107 if current_setting else 30108)) else: ui.show_notification(common.get_local_string(30106))
def logout(self, url): """Logout of the current account and reset the session""" common.debug('Logging out of current account') # Disable and reset auto-update / auto-sync features g.settings_monitor_suspended(True) g.ADDON.setSettingInt('lib_auto_upd_mode', 0) g.ADDON.setSettingBool('lib_sync_mylist', False) g.settings_monitor_suspended(False) g.SHARED_DB.delete_key('sync_mylist_profile_guid') cookies.delete(self.account_hash) self._get('logout') common.purge_credentials() common.info('Logout successful') ui.show_notification(common.get_local_string(30113)) self._init_session() xbmc.executebuiltin( 'XBMC.Container.Update(path,replace)') # Clean path history xbmc.executebuiltin( 'Container.Update({})'.format(url)) # Open root page
def reset_esn(self, pathitems=None): # pylint: disable=unused-argument """Reset the ESN stored (retrieved from website and manual)""" from resources.lib.database.db_utils import (TABLE_SESSION, TABLE_SETTINGS_MONITOR) if not ui.ask_for_confirmation(common.get_local_string(30217), common.get_local_string(30218)): return g.settings_monitor_suspended(True) # Reset the ESN obtained from website/generated g.LOCAL_DB.set_value('esn', '', TABLE_SESSION) # Reset the custom ESN (manual ESN from settings) g.ADDON.setSetting('esn', '') # Reset the custom ESN (backup of manual ESN from settings, used in settings_monitor.py) g.LOCAL_DB.set_value('custom_esn', '', TABLE_SETTINGS_MONITOR) g.settings_monitor_suspended(False) # Perform a new login to get/generate a new ESN api.login(ask_credentials=False) # Warning after login netflix switch to the main profile! so return to the main screen url = 'plugin://plugin.video.netflix/directory/root' xbmc.executebuiltin( 'XBMC.Container.Update(path,replace)') # Clean path history xbmc.executebuiltin( 'Container.Update({})'.format(url)) # Open root page