added loglevel from settings and exception to logmessages

This commit is contained in:
Marcel van der Veldt 2015-03-18 21:34:52 +01:00
parent b5214ad8ba
commit 200040dd62
2 changed files with 23 additions and 12 deletions

View file

@ -65,17 +65,18 @@ class LibrarySync():
WINDOW.setProperty("startup", "done") WINDOW.setProperty("startup", "done")
return True
def MoviesSync(self, fullsync=True): def MoviesSync(self, fullsync=True):
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
pDialog = None pDialog = None
try: try:
enableProgress = False
if(addon.getSetting("enableProgressFullSync")): if addon.getSetting("enableProgressFullSync") == 'true':
enableProgress = True
if(enableProgress):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
pDialog.create('Sync DB', 'Sync DB') pDialog.create('Sync DB', 'Sync DB')
@ -193,6 +194,8 @@ class LibrarySync():
if(self.ShouldStop()): if(self.ShouldStop()):
return True return True
except Exception, msg:
print "Exception in MoviesSync --> " + str(msg)
finally: finally:
if(pDialog != None): if(pDialog != None):
pDialog.close() pDialog.close()
@ -205,13 +208,14 @@ class LibrarySync():
pDialog = None pDialog = None
try: try:
enableProgress = False
if(addon.getSetting("enableProgressFullSync")): if addon.getSetting("enableProgressFullSync") == 'true':
enableProgress = True
if(enableProgress):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
pDialog.create('Sync DB', 'Sync DB') pDialog.create('Sync DB', 'Sync DB')
# incremental sync --> new episodes only # incremental sync --> new episodes only
if not fullsync: if not fullsync:
latestMBEpisodes = ReadEmbyDB().getLatestEpisodes(True) latestMBEpisodes = ReadEmbyDB().getLatestEpisodes(True)
@ -432,6 +436,8 @@ class LibrarySync():
if(self.ShouldStop()): if(self.ShouldStop()):
return True return True
except Exception, msg:
print "Exception in TvShowsSync --> " + str(msg)
finally: finally:
if(pDialog != None): if(pDialog != None):
pDialog.close() pDialog.close()
@ -458,7 +464,10 @@ class LibrarySync():
pDialog = None pDialog = None
try: try:
if(addon.getSetting("enableProgressPlayCountSync")): enableProgress = False
if addon.getSetting("enableProgressPlayCountSync") == 'true':
enableProgress = True
if(enableProgress):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
pDialog.create('Sync PlayCounts', 'Sync PlayCounts') pDialog.create('Sync PlayCounts', 'Sync PlayCounts')
@ -547,7 +556,10 @@ class LibrarySync():
percentage = int(((float(count) / float(totalCount)) * 100)) percentage = int(((float(count) / float(totalCount)) * 100))
pDialog.update(percentage, message="Updating Episode: " + str(count)) pDialog.update(percentage, message="Updating Episode: " + str(count))
count += 1 count += 1
except Exception, msg:
print "Exception in updatePlaycounts --> " + str(msg)
finally: finally:
if(pDialog != None): if(pDialog != None):
pDialog.close() pDialog.close()

View file

@ -24,9 +24,8 @@ addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
language = addonSettings.getLocalizedString language = addonSettings.getLocalizedString
def logMsg(title, msg, level = 1): def logMsg(title, msg, level = 1):
#todo --> get this from a setting logLevel = int(addonSettings.getSetting("logLevel"))
logLevel = 1
if(logLevel >= level): if(logLevel >= level):
if(logLevel == 1): if(logLevel == 1):