mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
some more optimizations - episodes dont need their artwork set
This commit is contained in:
parent
a20ccc1cc8
commit
a68c2cc796
2 changed files with 41 additions and 41 deletions
|
@ -356,44 +356,7 @@ class LibrarySync():
|
||||||
pDialog.update(percentage, progressTitle, "Adding Tv Show: " + str(count))
|
pDialog.update(percentage, progressTitle, "Adding Tv Show: " + str(count))
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
#initiate library update and wait for finish before processing any updates
|
#process episodes first before updating tvshows
|
||||||
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
|
|
||||||
allEpisodes = list()
|
allEpisodes = list()
|
||||||
|
|
||||||
showTotal = len(allTVShows)
|
showTotal = len(allTVShows)
|
||||||
|
@ -452,6 +415,44 @@ class LibrarySync():
|
||||||
if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
|
if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
|
||||||
pDialog.create('Sync DB', 'Sync DB')
|
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
|
# do episode updates
|
||||||
showCurrent = 1
|
showCurrent = 1
|
||||||
for tvshow in allTVShows:
|
for tvshow in allTVShows:
|
||||||
|
|
|
@ -268,8 +268,8 @@ class WriteKodiDB():
|
||||||
id = KodiItem['tvshowid']
|
id = KodiItem['tvshowid']
|
||||||
jsoncommand = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetTVShowDetails", "params": { "tvshowid": %i, "art": %s}, "id": 1 }'
|
jsoncommand = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetTVShowDetails", "params": { "tvshowid": %i, "art": %s}, "id": 1 }'
|
||||||
elif item_type == "Episode":
|
elif item_type == "Episode":
|
||||||
id = KodiItem['episodeid']
|
# episodes don't have any artwork - they derrive this from the tv show
|
||||||
jsoncommand = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": { "episodeid": %i, "art": %s}, "id": 1 }'
|
return False
|
||||||
elif item_type == "MusicVideo":
|
elif item_type == "MusicVideo":
|
||||||
id = KodiItem['musicvideoid']
|
id = KodiItem['musicvideoid']
|
||||||
jsoncommand = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetMusicVideoDetails", "params": { musicvideoid": %i, "art": %s}, "id": 1 }'
|
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["poster"] = API().getArtwork(MBitem, "Primary")
|
||||||
artwork["clearlogo"] = API().getArtwork(MBitem, "Logo")
|
artwork["clearlogo"] = API().getArtwork(MBitem, "Logo")
|
||||||
artwork["clearart"] = API().getArtwork(MBitem, "Art")
|
artwork["clearart"] = API().getArtwork(MBitem, "Art")
|
||||||
artwork["banner"] = API().getArtwork(MBitem, "Banner")
|
|
||||||
artwork["landscape"] = API().getArtwork(MBitem, "Thumb")
|
artwork["landscape"] = API().getArtwork(MBitem, "Thumb")
|
||||||
artwork["discart"] = API().getArtwork(MBitem, "Disc")
|
artwork["discart"] = API().getArtwork(MBitem, "Disc")
|
||||||
artwork["fanart"] = API().getArtwork(MBitem, "Backdrop")
|
artwork["fanart"] = API().getArtwork(MBitem, "Backdrop")
|
||||||
|
|
Loading…
Reference in a new issue