diff --git a/default.py b/default.py index 3912b4f5..03a338fc 100644 --- a/default.py +++ b/default.py @@ -120,7 +120,7 @@ class Main(): import librarysync lib = librarysync.LibrarySync() if mode == "manualsync": - librarysync.ManualSync().sync(dialog=True) + librarysync.ManualSync().sync() elif mode == "fastsync": lib.startSync() else: diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index ee2dc385..d3398f18 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -191,7 +191,7 @@ Use altername device Name [COLOR yellow]Retry login[/COLOR] Sync Options - Show syncing progress + Show progress if item count greater than Sync empty TV Shows Enable Music Library Direct stream music library diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 39fd0eaf..d5608a19 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -59,14 +59,13 @@ class LibrarySync(threading.Thread): threading.Thread.__init__(self) - def progressDialog(self, title, forced=False): + def progressDialog(self, title): dialog = None - if settings('dbSyncIndicator') == "true" or forced: - dialog = xbmcgui.DialogProgressBG() - dialog.create("Emby for Kodi", title) - log("Show progress dialog: %s" % title, 2) + dialog = xbmcgui.DialogProgressBG() + dialog.create("Emby for Kodi", title) + log("Show progress dialog: %s" % title, 2) return dialog @@ -201,7 +200,7 @@ class LibrarySync(threading.Thread): connection.commit() log("Commit successful.", 1) - def fullSync(self, manualrun=False, repair=False, forceddialog=False): + def fullSync(self, manualrun=False, repair=False): # Only run once when first setting up. Can be run manually. music_enabled = settings('enableMusic') == "true" @@ -234,13 +233,11 @@ class LibrarySync(threading.Thread): message = "Manual sync" elif repair: message = "Repair sync" - forceddialog = True else: message = "Initial sync" - forceddialog = True window('emby_initialScan', value="true") - pDialog = self.progressDialog("%s" % message, forced=forceddialog) + pDialog = self.progressDialog("%s" % message) starttotal = datetime.now() # Set views @@ -318,13 +315,14 @@ class LibrarySync(threading.Thread): utils.setScreensaver(value=screensaver) window('emby_dbScan', clear=True) window('emby_initialScan', clear=True) - if forceddialog: - xbmcgui.Dialog().notification( - heading=lang(29999), - message="%s %s %s" % - (message, lang(33025), str(elapsedtotal).split('.')[0]), - icon="special://home/addons/plugin.video.emby/icon.png", - sound=False) + + xbmcgui.Dialog().notification( + heading=lang(29999), + message="%s %s %s" % + (message, lang(33025), str(elapsedtotal).split('.')[0]), + icon="special://home/addons/plugin.video.emby/icon.png", + sound=False) + return True @@ -806,11 +804,14 @@ class LibrarySync(threading.Thread): self.forceLibraryUpdate = True update_embydb = True - if self.addedItems or self.updateItems or self.userdataItems or self.removeItems: + incSyncIndicator = int(settings('incSyncIndicator')) + totalUpdates = len(self.addedItems) + len(self.updateItems) + len(self.userdataItems) + len(self.removeItems) + log("incSyncIndicator=" + str(incSyncIndicator) + " totalUpdates=" + str(totalUpdates), 1) + + if incSyncIndicator != -1 and totalUpdates > incSyncIndicator: # Only present dialog if we are going to process items pDialog = self.progressDialog('Incremental sync') - process = { 'added': self.addedItems, @@ -1018,9 +1019,9 @@ class ManualSync(LibrarySync): LibrarySync.__init__(self) - def sync(self, dialog=False): + def sync(self): - return self.fullSync(manualrun=True, forceddialog=dialog) + return self.fullSync(manualrun=True) def movies(self, embycursor, kodicursor, pdialog): diff --git a/resources/settings.xml b/resources/settings.xml index 7ca31f61..5a25f3b1 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -26,11 +26,10 @@ - - + - +