some more optimizations - episodes dont need their artwork set

This commit is contained in:
Marcel van der Veldt 2015-03-20 14:37:34 +01:00
parent a20ccc1cc8
commit a68c2cc796
2 changed files with 41 additions and 41 deletions

View File

@ -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:

View File

@ -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")