def logout(self): """Logout of the current account and reset the session""" LOG.debug('Logging out of current account') # Perform the website logout self.get('logout') G.settings_monitor_suspend(True) # Disable and reset auto-update / auto-sync features G.ADDON.setSettingInt('lib_auto_upd_mode', 1) G.ADDON.setSettingBool('lib_sync_mylist', False) G.SHARED_DB.delete_key('sync_mylist_profile_guid') # Disable and reset the auto-select profile G.LOCAL_DB.set_value('autoselect_profile_guid', '') G.ADDON.setSetting('autoselect_profile_name', '') G.ADDON.setSettingBool('autoselect_profile_enabled', False) # Reset of selected profile guid for library playback G.LOCAL_DB.set_value('library_playback_profile_guid', '') G.ADDON.setSetting('library_playback_profile', '') G.settings_monitor_suspend(False) # Delete cookie and credentials self.session.cookies.clear() cookies.delete(self.account_hash) common.purge_credentials() # Reset the ESN obtained from website/generated G.LOCAL_DB.set_value('esn', '', TABLE_SESSION) # Reinitialize the MSL handler (delete msl data file, then reset everything) common.send_signal(signal=common.Signals.REINITIALIZE_MSL_HANDLER, data=True) G.CACHE.clear(clear_database=True) LOG.info('Logout successful') ui.show_notification(common.get_local_string(30113)) self._init_session() common.container_update('path', True) # Go to a fake page to clear screen # Open root page common.container_update(G.BASE_URL, True)
def logout(self): """Logout of the current account and reset the session""" LOG.debug('Logging out of current account') # Perform the website logout self.get('logout') with G.SETTINGS_MONITOR.ignore_events(2): # Disable and reset auto-update / auto-sync features G.ADDON.setSettingInt('lib_auto_upd_mode', 1) G.ADDON.setSettingBool('lib_sync_mylist', False) G.SHARED_DB.delete_key('sync_mylist_profile_guid') # Disable and reset the profile guid of profile auto-selection G.LOCAL_DB.set_value('autoselect_profile_guid', '') # Disable and reset the selected profile guid for library playback G.LOCAL_DB.set_value('library_playback_profile_guid', '') # Delete cookie and credentials self.session.cookies.clear() cookies.delete() common.purge_credentials() # Reinitialize the MSL handler (delete msl data file, then reset everything) common.send_signal(common.Signals.REINITIALIZE_MSL_HANDLER, {'delete_msl_file': True}) G.CACHE.clear(clear_database=True) LOG.info('Logout successful') ui.show_notification(common.get_local_string(30113)) self._init_session() common.container_update('path', True) # Go to a fake page to clear screen # Open root page common.container_update(G.BASE_URL, True)