diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 71d81d5f..ae121021 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -73,6 +73,7 @@ class Items(object): 'Audio': Music } + update_videolibrary = False total = 0 for item in items: total += len(items[item]) @@ -108,6 +109,7 @@ class Items(object): # Music is not enabled, do not proceed with itemtype continue else: + update_videolibrary = True items_process = itemtypes[itemtype](embycursor, kodicursor) if itemtype == "Movie": @@ -202,10 +204,11 @@ class Items(object): if musicconn is not None: # close connection for special types + self.logMsg("Updating music database.", 1) musicconn.commit() musiccursor.close() - return True + return (True, update_videolibrary) def contentPop(self, name, time=5000): xbmcgui.Dialog().notification( diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 2a7697cd..b55ffba5 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -728,12 +728,14 @@ class LibrarySync(threading.Thread): emby = self.emby emby_db = embydb.Embydb_Functions(embycursor) pDialog = None + update_embydb = False if self.refresh_views: # Received userconfig update self.refresh_views = False self.maintainViews(embycursor, kodicursor) self.forceLibraryUpdate = True + update_embydb = True if self.addedItems or self.updateItems or self.userdataItems or self.removeItems: # Only present dialog if we are going to process items @@ -771,23 +773,31 @@ class LibrarySync(threading.Thread): sorted_items = emby.sortby_mediatype(items['Unsorted']) doupdate = items_process.itemsbyId(sorted_items, "added", pDialog) if doupdate: - update = True + embyupdate, kodiupdate_video = doupdate + if embyupdate: + update_embydb = True + if kodiupdate_video: + self.forceLibraryUpdate = True del items['Unsorted'] doupdate = items_process.itemsbyId(items, type, pDialog) if doupdate: - update = True - - if update: - self.forceLibraryUpdate = True + embyupdate, kodiupdate_video = doupdate + if embyupdate: + update_embydb = True + if kodiupdate_video: + self.forceLibraryUpdate = True + if update_embydb: + update_embydb = False + self.logMsg("Updating emby database.", 1) + embyconn.commit() + self.saveLastSync() if self.forceLibraryUpdate: # Force update the Kodi library self.forceLibraryUpdate = False self.dbCommit(kodiconn) - embyconn.commit() - self.saveLastSync() self.logMsg("Updating video library.", 1) utils.window('emby_kodiScan', value="true") diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index 3b105d54..e26c90e3 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -253,7 +253,7 @@ class Read_EmbyServer(): self.logMsg("Throttle activated.", 1) if jump == highestjump: - # We already adjusted to highestjump, but it failed. Reset value + # We already tried with the highestjump, but it failed. Reset value. self.logMsg("Reset highest value.", 1) highestjump = 0