From 25286717b3eff9f8c0fce81981a4136b8f8da140 Mon Sep 17 00:00:00 2001 From: shaun Date: Sun, 5 Apr 2015 09:59:15 +1000 Subject: [PATCH] remove some redundant code calls and do a shouldstop call in the add loop --- resources/lib/LibrarySync.py | 5 +++++ resources/lib/WriteKodiDB.py | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index 226b5572..33010ebb 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -74,6 +74,7 @@ class LibrarySync(): finally: WINDOW.setProperty("SyncDatabaseRunning", "false") + utils.logMsg("Sync DB", "syncDatabase Exiting", 0) cursor.close() return True @@ -448,6 +449,10 @@ class LibrarySync(): count = 0 for item in episodeData: + + if(self.ShouldStop(pDialog)): + return False + progressAction = "Adding" WriteKodiDB().addEpisodeToKodiLibrary(item, connection, cursor) diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py index f12dba64..8254f42d 100644 --- a/resources/lib/WriteKodiDB.py +++ b/resources/lib/WriteKodiDB.py @@ -150,8 +150,8 @@ class WriteKodiDB(): port = addon.getSetting('port') host = addon.getSetting('ipaddress') server = host + ":" + port - downloadUtils = DownloadUtils() - userid = downloadUtils.getUserId() + #downloadUtils = DownloadUtils() + #userid = downloadUtils.getUserId() timeInfo = API().getTimeInfo(MBitem) userData=API().getUserData(MBitem) @@ -354,8 +354,8 @@ class WriteKodiDB(): port = addon.getSetting('port') host = addon.getSetting('ipaddress') server = host + ":" + port - downloadUtils = DownloadUtils() - userid = downloadUtils.getUserId() + #downloadUtils = DownloadUtils() + #userid = downloadUtils.getUserId() timeInfo = API().getTimeInfo(MBitem) people = API().getPeople(MBitem) @@ -760,8 +760,8 @@ class WriteKodiDB(): port = addon.getSetting('port') host = addon.getSetting('ipaddress') server = host + ":" + port - downloadUtils = DownloadUtils() - userid = downloadUtils.getUserId() + #downloadUtils = DownloadUtils() + #userid = downloadUtils.getUserId() timeInfo = API().getTimeInfo(MBitem) userData=API().getUserData(MBitem) @@ -986,8 +986,8 @@ class WriteKodiDB(): port = addon.getSetting('port') host = addon.getSetting('ipaddress') server = host + ":" + port - downloadUtils = DownloadUtils() - userid = downloadUtils.getUserId() + #downloadUtils = DownloadUtils() + #userid = downloadUtils.getUserId() timeInfo = API().getTimeInfo(MBitem) userData=API().getUserData(MBitem) @@ -1352,4 +1352,5 @@ class WriteKodiDB(): strSet = boxset["Name"] kodiMovie = ReadKodiDB().getKodiMovie(boxsetmovie["Id"]) if kodiMovie != None: - WriteKodiDB().updateProperty(kodiMovie,"set",strSet,"movie",True) \ No newline at end of file + WriteKodiDB().updateProperty(kodiMovie,"set",strSet,"movie",True) + \ No newline at end of file