Kodi database scan
Prevent writing to database when the kodi database scan is running.
This commit is contained in:
parent
43e8ad8775
commit
22b62133eb
2 changed files with 11 additions and 3 deletions
|
@ -28,6 +28,14 @@ class Kodi_Monitor( xbmc.Monitor ):
|
||||||
className = self.__class__.__name__
|
className = self.__class__.__name__
|
||||||
utils.logMsg("%s %s" % ("EMBY", className), msg, int(lvl))
|
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
|
#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
|
#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):
|
def onNotification (self, sender, method, data):
|
||||||
|
|
|
@ -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
|
# Add or update items
|
||||||
self.logMsg("Processing items: %s" % (str(self.updateItems)), 1)
|
self.logMsg("Processing items: %s" % (str(self.updateItems)), 1)
|
||||||
listItems = self.updateItems
|
listItems = self.updateItems
|
||||||
self.updateItems = []
|
self.updateItems = []
|
||||||
self.IncrementalSync(listItems)
|
self.IncrementalSync(listItems)
|
||||||
|
|
||||||
if len(self.userdataItems) > 0:
|
if len(self.userdataItems) > 0 and utils.window('kodiScan') != "true":
|
||||||
# Process userdata changes only
|
# Process userdata changes only
|
||||||
self.logMsg("Processing items: %s" % (str(self.userdataItems)), 1)
|
self.logMsg("Processing items: %s" % (str(self.userdataItems)), 1)
|
||||||
listItems = self.userdataItems
|
listItems = self.userdataItems
|
||||||
self.userdataItems = []
|
self.userdataItems = []
|
||||||
self.setUserdata(listItems)
|
self.setUserdata(listItems)
|
||||||
|
|
||||||
if len(self.removeItems) > 0:
|
if len(self.removeItems) > 0 and utils.window('kodiScan') != "true":
|
||||||
# Remove item from Kodi library
|
# Remove item from Kodi library
|
||||||
self.logMsg("Removing items: %s" % self.removeItems, 1)
|
self.logMsg("Removing items: %s" % self.removeItems, 1)
|
||||||
listItems = self.removeItems
|
listItems = self.removeItems
|
||||||
|
|
Loading…
Reference in a new issue