Fix library sync paused

This commit is contained in:
tomkat83 2016-03-09 15:53:46 +01:00
parent 9da6f5f616
commit b5bfad5719
3 changed files with 11 additions and 4 deletions

View file

@ -421,8 +421,17 @@ def switchPlexUser():
# Pause library sync thread - user needs to be auth in order to sync
utils.window('suspend_LibraryThread', value='true')
# Wait to ensure that any sync already going on has finished
counter = 0
while utils.window('emby_dbScan') == 'true':
xbmc.sleep(1000)
if counter > 100:
# Something went wrong, aborting
# Resuming threads, just in case
utils.window('suspend_LibraryThread', clear=True)
# Abort reConnection
return
counter += 1
xbmc.sleep(50)
# Log out currently signed in user:
utils.window('emby_serverStatus', value="401")
# Request lib sync to get user view data (e.g. watched/unwatched)

View file

@ -442,6 +442,7 @@ class UserClient(threading.Thread):
# to authenticate the user
self.auth = False
if self.authenticate():
# Successfully authenticated and loaded a user
log("Current user: %s" % self.currUser, 1)
log("Current userId: %s" % self.currUserId, 1)
log("Current accessToken: xxxx", 1)

View file

@ -254,9 +254,6 @@ class Service():
log("Server is online and ready.", 1)
window('emby_online', value="true")
# Start library sync thread in a suspended mode
# until signed in
utils.window('suspend_LibraryThread', value="true")
# Start the userclient thread
if not self.userclient_running:
self.userclient_running = True