From a68c2cc7961ca477b6c0d292e95602efc9c94c81 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Fri, 20 Mar 2015 14:37:34 +0100 Subject: [PATCH] some more optimizations - episodes dont need their artwork set --- resources/lib/LibrarySync.py | 77 ++++++++++++++++++------------------ resources/lib/WriteKodiDB.py | 5 +-- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index e2946862..792b2837 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -356,44 +356,7 @@ class LibrarySync(): pDialog.update(percentage, progressTitle, "Adding Tv Show: " + str(count)) count += 1 - #initiate library update and wait for finish before processing any updates - if updateNeeded: - - if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG): - pDialog.close() - - self.doKodiLibraryUpdate(False, pDialog) - updateNeeded = False - - if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG): - pDialog.create('Sync DB', 'Sync DB') - - if(pDialog != None): - progressTitle = "Sync DB : Processing TV Shows" - pDialog.update(0, progressTitle, "") - total = len(allTVShows) + 1 - count = 1 - - #process updates at TV Show level - allKodiTVShows = ReadKodiDB().getKodiTvShows(True) - for item in tvShowData: - if item.get('IsFolder'): - - kodishow = allKodiTVShows.get(item["Id"],None) - - if(kodishow != None): - WriteKodiDB().updateTVShowToKodiLibrary(item,kodishow) - - if(self.ShouldStop(pDialog)): - return True - - # update progress bar - if(pDialog != None): - percentage = int(((float(count) / float(total)) * 100)) - pDialog.update(percentage, progressTitle, "Updating Tv Show: " + str(count)) - count += 1 - - #process episodes + #process episodes first before updating tvshows allEpisodes = list() showTotal = len(allTVShows) @@ -452,6 +415,44 @@ class LibrarySync(): if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG): pDialog.create('Sync DB', 'Sync DB') + + #initiate library update and wait for finish before processing any updates + if updateNeeded: + + if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG): + pDialog.close() + + self.doKodiLibraryUpdate(False, pDialog) + updateNeeded = False + + if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG): + pDialog.create('Sync DB', 'Sync DB') + + if(pDialog != None): + progressTitle = "Sync DB : Processing TV Shows" + pDialog.update(0, progressTitle, "") + total = len(allTVShows) + 1 + count = 1 + + #process updates at TV Show level + allKodiTVShows = ReadKodiDB().getKodiTvShows(True) + for item in tvShowData: + if item.get('IsFolder'): + + kodishow = allKodiTVShows.get(item["Id"],None) + + if(kodishow != None): + WriteKodiDB().updateTVShowToKodiLibrary(item,kodishow) + + if(self.ShouldStop(pDialog)): + return True + + # update progress bar + if(pDialog != None): + percentage = int(((float(count) / float(total)) * 100)) + pDialog.update(percentage, progressTitle, "Updating Tv Show: " + str(count)) + count += 1 + # do episode updates showCurrent = 1 for tvshow in allTVShows: diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py index c00719c8..1fb2de78 100644 --- a/resources/lib/WriteKodiDB.py +++ b/resources/lib/WriteKodiDB.py @@ -268,8 +268,8 @@ class WriteKodiDB(): id = KodiItem['tvshowid'] jsoncommand = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetTVShowDetails", "params": { "tvshowid": %i, "art": %s}, "id": 1 }' elif item_type == "Episode": - id = KodiItem['episodeid'] - jsoncommand = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": { "episodeid": %i, "art": %s}, "id": 1 }' + # episodes don't have any artwork - they derrive this from the tv show + return False elif item_type == "MusicVideo": id = KodiItem['musicvideoid'] jsoncommand = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetMusicVideoDetails", "params": { musicvideoid": %i, "art": %s}, "id": 1 }' @@ -284,7 +284,6 @@ class WriteKodiDB(): artwork["poster"] = API().getArtwork(MBitem, "Primary") artwork["clearlogo"] = API().getArtwork(MBitem, "Logo") artwork["clearart"] = API().getArtwork(MBitem, "Art") - artwork["banner"] = API().getArtwork(MBitem, "Banner") artwork["landscape"] = API().getArtwork(MBitem, "Thumb") artwork["discart"] = API().getArtwork(MBitem, "Disc") artwork["fanart"] = API().getArtwork(MBitem, "Backdrop")