Kodi database scan

Prevent writing to database when the kodi database scan is running.
This commit is contained in:
angelblue05 2015-10-22 21:55:27 -05:00
parent 43e8ad8775
commit 22b62133eb
2 changed files with 11 additions and 3 deletions

View file

@ -28,6 +28,14 @@ class Kodi_Monitor( xbmc.Monitor ):
className = self.__class__.__name__
utils.logMsg("%s %s" % ("EMBY", className), msg, int(lvl))
def onScanStarted(self, library):
utils.window('kodiScan', value="true")
self.logMsg("Kodi library scan running.", 2)
def onScanFinished(self, library):
utils.window('kodiScan', clear=True)
self.logMsg("Kodi library scan finished.", 2)
#this library monitor is used to detect a watchedstate change by the user through the library
#as well as detect when a library item has been deleted to pass the delete to the Emby server
def onNotification (self, sender, method, data):

View file

@ -1108,21 +1108,21 @@ class LibrarySync(threading.Thread):
if len(self.updateItems) > 0:
if len(self.updateItems) > 0 and utils.window('kodiScan') != "true":
# Add or update items
self.logMsg("Processing items: %s" % (str(self.updateItems)), 1)
listItems = self.updateItems
self.updateItems = []
self.IncrementalSync(listItems)
if len(self.userdataItems) > 0:
if len(self.userdataItems) > 0 and utils.window('kodiScan') != "true":
# Process userdata changes only
self.logMsg("Processing items: %s" % (str(self.userdataItems)), 1)
listItems = self.userdataItems
self.userdataItems = []
self.setUserdata(listItems)
if len(self.removeItems) > 0:
if len(self.removeItems) > 0 and utils.window('kodiScan') != "true":
# Remove item from Kodi library
self.logMsg("Removing items: %s" % self.removeItems, 1)
listItems = self.removeItems