From 200040dd621e35df1bb8d231a7c34f05356968ea Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Wed, 18 Mar 2015 21:34:52 +0100 Subject: [PATCH] added loglevel from settings and exception to logmessages --- resources/lib/LibrarySync.py | 30 +++++++++++++++++++++--------- resources/lib/Utils.py | 5 ++--- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index f4635f6f..299bafaf 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -65,17 +65,18 @@ class LibrarySync(): WINDOW.setProperty("startup", "done") - + return True def MoviesSync(self, fullsync=True): - WINDOW = xbmcgui.Window( 10000 ) pDialog = None try: - - if(addon.getSetting("enableProgressFullSync")): + enableProgress = False + if addon.getSetting("enableProgressFullSync") == 'true': + enableProgress = True + if(enableProgress): pDialog = xbmcgui.DialogProgressBG() if(pDialog != None): pDialog.create('Sync DB', 'Sync DB') @@ -193,6 +194,8 @@ class LibrarySync(): if(self.ShouldStop()): return True + except Exception, msg: + print "Exception in MoviesSync --> " + str(msg) finally: if(pDialog != None): pDialog.close() @@ -205,13 +208,14 @@ class LibrarySync(): pDialog = None try: - - if(addon.getSetting("enableProgressFullSync")): + enableProgress = False + if addon.getSetting("enableProgressFullSync") == 'true': + enableProgress = True + if(enableProgress): pDialog = xbmcgui.DialogProgressBG() if(pDialog != None): pDialog.create('Sync DB', 'Sync DB') - # incremental sync --> new episodes only if not fullsync: latestMBEpisodes = ReadEmbyDB().getLatestEpisodes(True) @@ -432,6 +436,8 @@ class LibrarySync(): if(self.ShouldStop()): return True + except Exception, msg: + print "Exception in TvShowsSync --> " + str(msg) finally: if(pDialog != None): pDialog.close() @@ -458,7 +464,10 @@ class LibrarySync(): pDialog = None try: - if(addon.getSetting("enableProgressPlayCountSync")): + enableProgress = False + if addon.getSetting("enableProgressPlayCountSync") == 'true': + enableProgress = True + if(enableProgress): pDialog = xbmcgui.DialogProgressBG() if(pDialog != None): pDialog.create('Sync PlayCounts', 'Sync PlayCounts') @@ -547,7 +556,10 @@ class LibrarySync(): percentage = int(((float(count) / float(totalCount)) * 100)) pDialog.update(percentage, message="Updating Episode: " + str(count)) count += 1 - + + except Exception, msg: + print "Exception in updatePlaycounts --> " + str(msg) + finally: if(pDialog != None): pDialog.close() diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index 3bb02e07..f4788622 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -24,9 +24,8 @@ addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync') language = addonSettings.getLocalizedString def logMsg(title, msg, level = 1): - - #todo --> get this from a setting - logLevel = 1 + + logLevel = int(addonSettings.getSetting("logLevel")) if(logLevel >= level): if(logLevel == 1):