fixed season artwork

This commit is contained in:
Marcel van der Veldt 2015-03-20 16:58:46 +01:00
parent acbf9ee258
commit 63bd250c4b
2 changed files with 32 additions and 6 deletions

View file

@ -125,9 +125,7 @@ class CreateFiles():
seasonart2 = API().getArtwork(season, "Banner")
if seasonart2 != None:
SubElement(root, "thumb",{"type":"season","aspect":"banner","season":str(season["IndexNumber"])}).text = seasonart2
seasonart3 = API().getArtwork(season, "Thumb")
if seasonart2 != None:
SubElement(root, "thumb",{"type":"season","aspect":"landscape","season":str(season["IndexNumber"])}).text = seasonart3
SubElement(root, "fanart").text = API().getArtwork(item, "Backdrop")
SubElement(root, "title").text = utils.convertEncoding(item["Name"])
SubElement(root, "originaltitle").text = utils.convertEncoding(item["Name"])

View file

@ -15,6 +15,7 @@ import os
from DownloadUtils import DownloadUtils
from CreateFiles import CreateFiles
from ReadKodiDB import ReadKodiDB
from ReadEmbyDB import ReadEmbyDB
from API import API
import Utils as utils
@ -202,6 +203,9 @@ class WriteKodiDB():
#add actors
changes |= self.AddActorsToMedia(KodiItem,MBitem.get("People"),"tvshow")
#update season artwork
self.updateSeasonArtwork(MBitem, KodiItem)
CreateFiles().createNFO(MBitem)
if changes:
@ -441,10 +445,34 @@ class WriteKodiDB():
xbmcvfs.rmdir(path)
def updateSeasonDetails(self,MBitem, KodiItem):
#use sqlite to set the season artwork because with NFO it sets the poster as banner
pass
def updateSeasonArtwork(self,MBitem, KodiItem):
#use sqlite to set the season artwork because no method in API available for this
#season poster and banner are set by the nfo. landscape image is filled by this method
#if wanted this feature can be extended to also update the other artwork
tvshowid = KodiItem["tvshowid"]
dbPath = xbmc.translatePath("special://userdata/Database/MyVideos90.db")
connection = sqlite3.connect(dbPath)
cursor = connection.cursor( )
seasonData = ReadEmbyDB().getTVShowSeasons(MBitem["Id"])
if seasonData != None:
for season in seasonData:
if season.has_key("IndexNumber"):
MB3landscape = API().getArtwork(season, "Thumb")
if MB3landscape != "":
cursor.execute("SELECT idSeason as seasonid FROM seasons WHERE idShow = ? and season = ?",(tvshowid,season["IndexNumber"]))
result = cursor.fetchone()
if result != None:
seasonid = result[0]
cursor.execute("SELECT art_id as art_id FROM art WHERE media_id = ? and media_type = ? and type = ?",(seasonid,"season","landscape"))
result = cursor.fetchone()
if result == None:
sql="INSERT into art(media_id, media_type, type, url) values(?, ?, ?, ?)"
cursor.execute(sql, (seasonid,"season","landscape",MB3landscape))
connection.commit()
cursor.close()