Wait for lib sync to finish when switching user

This commit is contained in:
tomkat83 2016-03-03 09:35:35 +01:00
parent 2750c4b16d
commit cc3c55e038
2 changed files with 3 additions and 9 deletions

View file

@ -364,7 +364,8 @@ def switchPlexUser():
"Plex home user switch requested", 0) "Plex home user switch requested", 0)
# Pause library sync thread - user needs to be auth in order to sync # Pause library sync thread - user needs to be auth in order to sync
utils.window('suspend_LibraryThread', value='true') utils.window('suspend_LibraryThread', value='true')
# Wait 1 second to ensure that library thread is indeed suspended # Wait to ensure that any sync already going on has finished
while utils.window('emby_dbScan' == 'true'):
xbmc.sleep(1000) xbmc.sleep(1000)
# Log out currently signed in user: # Log out currently signed in user:
utils.window('emby_serverStatus', value="401") utils.window('emby_serverStatus', value="401")

View file

@ -421,7 +421,6 @@ class LibrarySync(Thread):
# Get current media folders from emby database # Get current media folders from emby database
view = emby_db.getView_byId(folderid) view = emby_db.getView_byId(folderid)
self.logMsg("playlist: %s, nodes: %s, sorted_views: %s, folderid: %s, foldername: %s, viewtype: %s" % (playlists, nodes, sorted_views, folderid, foldername, viewtype))
try: try:
current_viewname = view[0] current_viewname = view[0]
current_viewtype = view[1] current_viewtype = view[1]
@ -1228,12 +1227,6 @@ class LibrarySync(Thread):
log('Running automatic full lib scan', 0) log('Running automatic full lib scan', 0)
self.fullSync(manualrun=True) self.fullSync(manualrun=True)
window('emby_dbScan', clear=True) window('emby_dbScan', clear=True)
# Update views / PMS libraries approx. every 5min
elif count % 300 == 0:
log('Running maintainViews() scan', 0)
window('emby_dbScan', value="true")
self.maintainViews()
self.startSync()
# Run fast sync otherwise (ever 2 seconds or so) # Run fast sync otherwise (ever 2 seconds or so)
else: else:
self.startSync() self.startSync()