sync progress changes

add (if item count greater) for sync progress dialog
always show progress for full sync
This commit is contained in:
shaun 2016-07-03 13:26:11 +10:00
parent 46d73464bb
commit a911249840
4 changed files with 25 additions and 25 deletions

View File

@ -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:

View File

@ -191,7 +191,7 @@
<string id="30504">Use altername device Name</string>
<string id="30505">[COLOR yellow]Retry login[/COLOR]</string>
<string id="30506">Sync Options</string>
<string id="30507">Show syncing progress</string>
<string id="30507">Show progress if item count greater than</string>
<string id="30508">Sync empty TV Shows</string>
<string id="30509">Enable Music Library</string>
<string id="30510">Direct stream music library</string>

View File

@ -59,11 +59,10 @@ 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)
@ -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)
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):

View File

@ -26,11 +26,10 @@
<category label="30506"><!-- Sync Options -->
<setting id="serverSync" type="bool" label="30514" default="true" />
<setting id="dbSyncIndicator" label="30507" type="bool" default="false" />
<setting type="sep" />
<setting id="incSyncIndicator" label="30507" type="number" default="10" visible="eq(-1,true)" subsetting="true"/>
<setting id="limitindex" type="number" label="30515" default="200" option="int" />
<setting id="enableTextureCache" label="30512" type="bool" default="true" />
<setting id="imageCacheLimit" type="enum" label="30513" values="Disabled|5|10|15|20|25" default="0" visible="eq(-1,true)" subsetting="true" />
<setting id="imageCacheLimit" type="enum" label="30513" values="Unlimited|5|10|15|20|25" default="5" visible="eq(-1,true)" subsetting="true" />
<setting id="syncEmptyShows" type="bool" label="30508" default="false" />
<setting id="dbSyncScreensaver" label="30536" type="bool" default="false" />
<setting id="useDirectPaths" type="enum" label="30511" lvalues="33036|33037" default="0" />