Always log out user on user or PMS switch

This commit is contained in:
tomkat83 2016-05-29 17:36:07 +02:00
parent 8aec935478
commit 153717da68

View file

@ -90,7 +90,7 @@ def chooseServer():
utils.logMsg(title, "User chose server %s" % server['name'], 1) utils.logMsg(title, "User chose server %s" % server['name'], 1)
setup.WritePMStoSettings(server) setup.WritePMStoSettings(server)
if not __LogOut(user=True): if not __LogOut():
return return
# First remove playlists # First remove playlists
@ -99,7 +99,7 @@ def chooseServer():
utils.deleteNodes() utils.deleteNodes()
# Log in again # Log in again
__LogIn(user=True) __LogIn()
utils.logMsg(title, "Choosing new PMS complete", 1) utils.logMsg(title, "Choosing new PMS complete", 1)
# '<PMS> connected' # '<PMS> connected'
xbmcgui.Dialog().notification( xbmcgui.Dialog().notification(
@ -493,7 +493,7 @@ def switchPlexUser():
# position = 0 # position = 0
# utils.window('EmbyAdditionalUserImage.%s' % position, clear=True) # utils.window('EmbyAdditionalUserImage.%s' % position, clear=True)
utils.logMsg(title, "Plex home user switch requested", 0) utils.logMsg(title, "Plex home user switch requested", 0)
if not __LogOut(user=True): if not __LogOut():
return return
# First remove playlists of old user # First remove playlists of old user
@ -1672,27 +1672,23 @@ def enterPMS():
__LogIn() __LogIn()
def __LogIn(user=False): def __LogIn():
""" """
Resets (clears) window properties to enable (re-)login: Resets (clears) window properties to enable (re-)login:
suspend_Userclient suspend_Userclient
plex_runLibScan: set to 'full' to trigger lib sync plex_runLibScan: set to 'full' to trigger lib sync
user=False: user has NOT been signed out before
suspend_LibraryThread is cleared in service.py if user was signed out! suspend_LibraryThread is cleared in service.py if user was signed out!
""" """
utils.window('plex_runLibScan', value='full') utils.window('plex_runLibScan', value='full')
# Restart user client # Restart user client
utils.window('suspend_Userclient', clear=True) utils.window('suspend_Userclient', clear=True)
if user is False:
utils.window('suspend_LibraryThread', clear=True)
def __LogOut(user=False): def __LogOut():
""" """
Finishes lib scans, logs out user. The following window attributes are set: Finishes lib scans, logs out user. The following window attributes are set:
suspend_LibraryThread: 'true' suspend_LibraryThread: 'true'
If user=True, then the user will also be logged out
suspend_Userclient: 'true' suspend_Userclient: 'true'
Returns True if successfully signed out, False otherwise Returns True if successfully signed out, False otherwise
@ -1722,7 +1718,6 @@ def __LogOut(user=False):
xbmc.sleep(50) xbmc.sleep(50)
utils.logMsg(title, "Successfully stopped library sync", 1) utils.logMsg(title, "Successfully stopped library sync", 1)
if user:
# Log out currently signed in user: # Log out currently signed in user:
utils.window('emby_serverStatus', value="401") utils.window('emby_serverStatus', value="401")
# Above method needs to have run its course! Hence wait # Above method needs to have run its course! Hence wait