Add artwork to All-season

Turns out All-season is -1.
This commit is contained in:
angelblue05 2015-06-18 05:10:49 -05:00
parent 494e326413
commit aa156a5a63

View file

@ -765,6 +765,21 @@ class WriteKodiVideoDB():
imageUrl = API().getArtwork(season, "Banner") imageUrl = API().getArtwork(season, "Banner")
self.addOrUpdateArt(imageUrl, seasonid, "season", "banner", cursor) self.addOrUpdateArt(imageUrl, seasonid, "season", "banner", cursor)
# Set All season poster
MBitem = ReadEmbyDB().getFullItem(embyTvShowId)
seasonNum = -1
cursor.execute("SELECT idSeason as seasonid FROM seasons WHERE idShow = ? and season = ?", (kodiTvShowId, seasonNum))
result = cursor.fetchone()
if result == None:
# Create the all-season
cursor.execute("select coalesce(max(idSeason),0) as seasonid from seasons")
seasonid = cursor.fetchone()[0]
seasonid = seasonid + 1
cursor.execute("INSERT into seasons(idSeason, idShow, season) values(?, ?, ?)", (seasonid, kodiTvShowId, seasonNum))
else:
seasonid = result[0]
imageUrl = API().getArtwork(MBitem, "Primary")
self.addOrUpdateArt(imageUrl, seasonid, "season", "poster", cursor)
def addOrUpdateArt(self, imageUrl, kodiId, mediaType, imageType, cursor): def addOrUpdateArt(self, imageUrl, kodiId, mediaType, imageType, cursor):
updateDone = False updateDone = False