Adjust librarysync notifications

This commit is contained in:
tomkat83 2016-02-11 14:44:11 +01:00
parent fa8c6e49b8
commit f162b6ea8a

View file

@ -217,12 +217,23 @@ class LibrarySync(Thread):
self.installSyncDone = True if \ self.installSyncDone = True if \
utils.settings('SyncInstallRunDone') == 'true' else False utils.settings('SyncInstallRunDone') == 'true' else False
self.showDbSync = True if \ self.showDbSync = True if \
utils.settings('dbSyncIndicator') == 'true' else False utils.settings('dbSyncIndicator') == 'true' else False
Thread.__init__(self) Thread.__init__(self)
def showKodiNote(self, message, forced=False):
"""
Shows a Kodi popup, if user selected to do so
"""
if not (self.showDbSync or forced):
return
xbmcgui.Dialog().notification(
heading=self.addonName,
message=message,
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
sound=False)
def startSync(self): def startSync(self):
utils.window('emby_dbScan', value="true") utils.window('emby_dbScan', value="true")
completed = self.fastSync() completed = self.fastSync()
@ -408,12 +419,9 @@ class LibrarySync(Thread):
elapsedtotal = datetime.now() - starttotal elapsedtotal = datetime.now() - starttotal
utils.window('emby_initialScan', clear=True) utils.window('emby_initialScan', clear=True)
xbmcgui.Dialog().notification( self.showKodiNote("%s completed in: %s"
heading=self.addonName, % (message, str(elapsedtotal).split('.')[0]))
message="%s completed in: %s"
% (message, str(elapsedtotal).split('.')[0]),
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
sound=False)
return True return True
def processView(self, folderItem, kodi_db, emby_db, totalnodes): def processView(self, folderItem, kodi_db, emby_db, totalnodes):
@ -678,8 +686,10 @@ class LibrarySync(Thread):
threads.append(thread) threads.append(thread)
self.logMsg("Processing thread spawned", 1) self.logMsg("Processing thread spawned", 1)
# Start one thread to show sync progress # Start one thread to show sync progress
if self.showDbSync:
dialog = xbmcgui.DialogProgressBG() dialog = xbmcgui.DialogProgressBG()
thread = ThreadedShowSyncInfo(dialog, thread = ThreadedShowSyncInfo(
dialog,
[getMetadataLock, processMetadataLock], [getMetadataLock, processMetadataLock],
itemNumber, itemNumber,
itemType) itemType)
@ -705,9 +715,6 @@ class LibrarySync(Thread):
del threads del threads
except: except:
self.logMsg("Could not delete threads", -1) self.logMsg("Could not delete threads", -1)
# Make sure dialog window is closed
if dialog:
dialog.close()
self.logMsg("Sync threads finished", 1) self.logMsg("Sync threads finished", 1)
self.updatelist = [] self.updatelist = []
return True return True