Clean out library sync

This commit is contained in:
tomkat83 2016-03-08 12:13:47 +01:00
parent b05ec9746a
commit d5aae4934b

View file

@ -160,10 +160,10 @@ class ThreadedShowSyncInfo(Thread):
threadStopped = self.threadStopped threadStopped = self.threadStopped
downloadLock = self.locks[0] downloadLock = self.locks[0]
processLock = self.locks[1] processLock = self.locks[1]
dialog.create(("%s: Sync %s: %s items" dialog.create("%s: Sync %s: %s items"
% (self.addonName, % (self.addonName,
self.itemType, self.itemType,
str(total))).encode('utf-8'), str(total)),
"Starting") "Starting")
global getMetadataCount global getMetadataCount
global processMetadataCount global processMetadataCount
@ -181,15 +181,11 @@ class ThreadedShowSyncInfo(Thread):
percentage = int(float(totalProgress) / float(total)*100.0) percentage = int(float(totalProgress) / float(total)*100.0)
except ZeroDivisionError: except ZeroDivisionError:
percentage = 0 percentage = 0
try: dialog.update(percentage,
dialog.update( message="Downloaded: %s. Processed: %s: %s"
percentage, % (getMetadataProgress,
message=("Downloaded: %s. Processed: %s: %s" processMetadataProgress,
% (getMetadataProgress, processMetadataProgress, viewName))
viewName))).encode('utf-8')
except:
# Wierd formating of the string viewName?!?
pass
# Sleep for x milliseconds # Sleep for x milliseconds
xbmc.sleep(500) xbmc.sleep(500)
dialog.close() dialog.close()
@ -224,20 +220,20 @@ class LibrarySync(Thread):
self.enableMusic = True if utils.settings('enableMusic') == "true" \ self.enableMusic = True if utils.settings('enableMusic') == "true" \
else False else False
self.enableBackgroundSync = True if utils.settings( self.enableBackgroundSync = True if utils.settings(
'enableBackgroundSync') == "true" \ 'enableBackgroundSync') == "true" else False
else False
Thread.__init__(self) Thread.__init__(self)
def showKodiNote(self, message, forced=False): def showKodiNote(self, message, forced=False):
""" """
Shows a Kodi popup, if user selected to do so Shows a Kodi popup, if user selected to do so. Pass message in unicode
or string
""" """
if not (self.showDbSync or forced): if not (self.showDbSync or forced):
return return
xbmcgui.Dialog().notification( xbmcgui.Dialog().notification(
heading=self.addonName, heading=self.addonName,
message=message.encode('utf-8'), message=message,
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png", icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
sound=False) sound=False)
@ -279,8 +275,8 @@ class LibrarySync(Thread):
if self.threadStopped(): if self.threadStopped():
return True return True
# Get items per view # Get items per view
items = PlexFunctions.GetAllPlexLeaves( items = PlexFunctions.GetAllPlexLeaves(view['id'],
view['id'], updatedAt=lastSync) updatedAt=lastSync)
# Just skip item if something went wrong # Just skip item if something went wrong
if not items: if not items:
continue continue
@ -444,7 +440,7 @@ class LibrarySync(Thread):
"Found viewid: %s" % folderid, "Found viewid: %s" % folderid,
"viewname: %s" % current_viewname, "viewname: %s" % current_viewname,
"viewtype: %s" % current_viewtype, "viewtype: %s" % current_viewtype,
"tagid: %s" % current_tagid)), 2) "tagid: %s" % current_tagid)), 1)
# Remove views that are still valid to delete rest later # Remove views that are still valid to delete rest later
try: try: