mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 18:26:15 +00:00
improvement to tvshows sync: also process updates at tv show level at first sync
This commit is contained in:
parent
cbfc40f430
commit
6eba8db57a
4 changed files with 36 additions and 17 deletions
|
@ -119,7 +119,10 @@ class CreateFiles():
|
|||
if seasonData != None:
|
||||
for season in seasonData:
|
||||
if season.has_key("IndexNumber"):
|
||||
SubElement(root, "thumb",{"type":"season","season":str(season["IndexNumber"])}).text = API().getArtwork(season, "Primary")
|
||||
seasonart = API().getArtwork(season, "Primary")
|
||||
if seasonart == None:
|
||||
seasonart = API().getArtwork(item, "Primary")
|
||||
SubElement(root, "thumb",{"type":"season","season":str(season["IndexNumber"])}).text = seasonart
|
||||
SubElement(root, "thumb",{"type":"season","season":"0"}).text = API().getArtwork(item, "Primary")
|
||||
|
||||
SubElement(root, "fanart").text = API().getArtwork(item, "Backdrop")
|
||||
|
|
|
@ -324,7 +324,7 @@ class LibrarySync():
|
|||
allEpisodes = list()
|
||||
#FIXME --> for now pull all tv shows and use the incremental update only at episode level
|
||||
tvShowData = ReadEmbyDB().getTVShows(True,True)
|
||||
|
||||
allKodiIds = set(ReadKodiDB().getKodiTvShowsIds(True))
|
||||
updateNeeded = False
|
||||
|
||||
if(self.ShouldStop(pDialog)):
|
||||
|
@ -341,16 +341,11 @@ class LibrarySync():
|
|||
|
||||
for item in tvShowData:
|
||||
if item.get('IsFolder'):
|
||||
kodiItem = ReadKodiDB().getKodiTVShow(item["Id"])
|
||||
allTVShows.append(item["Id"])
|
||||
progMessage = "Processing"
|
||||
if kodiItem == None:
|
||||
WriteKodiDB().addTVShowToKodiLibrary(item)
|
||||
if item["Id"] not in allKodiIds:
|
||||
WriteKodiDB().addMovieToKodiLibrary(item)
|
||||
updateNeeded = True
|
||||
progMessage = "Adding"
|
||||
else:
|
||||
WriteKodiDB().updateTVShowToKodiLibrary(item, kodiItem)
|
||||
progMessage = "Updating"
|
||||
|
||||
if(self.ShouldStop(pDialog)):
|
||||
return True
|
||||
|
@ -358,7 +353,7 @@ class LibrarySync():
|
|||
# update progress bar
|
||||
if(pDialog != None):
|
||||
percentage = int(((float(count) / float(total)) * 100))
|
||||
pDialog.update(percentage, progressTitle, progMessage + " Tv Show: " + str(count))
|
||||
pDialog.update(percentage, progressTitle, "Adding Tv Show: " + str(count))
|
||||
count += 1
|
||||
|
||||
#initiate library update and wait for finish before processing any updates
|
||||
|
@ -373,9 +368,32 @@ class LibrarySync():
|
|||
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(allMB3Movies) + 1
|
||||
count = 1
|
||||
|
||||
#process episodes (will only be possible when tv show is scanned to library)
|
||||
#TODO --> maybe pull full info only when needed ?
|
||||
#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()
|
||||
|
||||
showTotal = len(allTVShows)
|
||||
|
|
|
@ -95,8 +95,6 @@ class ReadKodiDB():
|
|||
|
||||
return allKodiTvShowsIds
|
||||
|
||||
|
||||
|
||||
def getKodiTvShows(self,fullInfo = False):
|
||||
#returns all tvshows in Kodi db inserted by MB
|
||||
xbmc.sleep(sleepVal)
|
||||
|
|
|
@ -176,7 +176,7 @@ class WriteKodiDB():
|
|||
changes = False
|
||||
|
||||
#update artwork
|
||||
#changes |= self.updateArtWork(KodiItem,"poster", API().getArtwork(MBitem, "Primary"),"tvshow")
|
||||
changes |= self.updateArtWork(KodiItem,"poster", API().getArtwork(MBitem, "Primary"),"tvshow")
|
||||
changes |= self.updateArtWork(KodiItem,"clearlogo", API().getArtwork(MBitem, "Logo"),"tvshow")
|
||||
changes |= self.updateArtWork(KodiItem,"clearart", API().getArtwork(MBitem, "Art"),"tvshow")
|
||||
changes |= self.updateArtWork(KodiItem,"banner", API().getArtwork(MBitem, "Banner"),"tvshow")
|
||||
|
|
Loading…
Reference in a new issue