From 86e7a9622ee4b557f15ae84a71e7df0f1f7b683b Mon Sep 17 00:00:00 2001 From: xnappo Date: Sat, 4 Apr 2015 11:09:14 -0500 Subject: [PATCH] Don't do episode checks on first run --- resources/lib/LibrarySync.py | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index 4b451faf..96bf3c24 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -448,25 +448,29 @@ class LibrarySync(): #we have to compare the lists somehow # TODO --> instead of matching by season and episode number we can use the uniqueid for item in episodeData: - comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber")) - matchFound = False - if kodiEpisodes != None: - KodiItem = kodiEpisodes.get(comparestring1, None) - if(KodiItem != None): - matchFound = True - - progressAction = "Checking" - if not matchFound: - #double check the item it might me added delayed by the Kodi scanner - if ReadKodiDB().getKodiEpisodeByMbItem(item["Id"],tvshow) == None: - #no match so we have to create it - WriteKodiDB().addEpisodeToKodiLibrary(item) - progressAction = "Adding" - totalItemsAdded += 1 - - if(self.ShouldStop(pDialog)): - return False - + if(installFirstRun): + progressAction = "Adding" + WriteKodiDB().addEpisodeToKodiLibrary(item) + else: + comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber")) + matchFound = False + if kodiEpisodes != None: + KodiItem = kodiEpisodes.get(comparestring1, None) + if(KodiItem != None): + matchFound = True + + progressAction = "Checking" + if not matchFound: + #double check the item it might me added delayed by the Kodi scanner + if ReadKodiDB().getKodiEpisodeByMbItem(item["Id"],tvshow) == None: + #no match so we have to create it + WriteKodiDB().addEpisodeToKodiLibrary(item) + progressAction = "Adding" + totalItemsAdded += 1 + + if(self.ShouldStop(pDialog)): + return False + # update progress bar if(pDialog != None): percentage = int(((float(count) / float(total)) * 100))