small optimalizations and fix for key error at season artwork

This commit is contained in:
Marcel van der Veldt 2015-03-20 01:09:04 +01:00
parent 5b65e1cfda
commit 845f0cc809
2 changed files with 9 additions and 8 deletions

View file

@ -113,15 +113,15 @@ class CreateFiles():
SubElement(root, "tag").text = tag SubElement(root, "tag").text = tag
SubElement(root, "thumb").text = API().getArtwork(item, "Primary") SubElement(root, "thumb").text = API().getArtwork(item, "Primary")
if item_type == 'Series': if item_type == 'Series':
seasonData = ReadEmbyDB().getTVShowSeasons(item["Id"]) seasonData = ReadEmbyDB().getTVShowSeasons(item["Id"])
if seasonData != None: if seasonData != None:
for season in seasonData: for season in seasonData:
SubElement(root, "thumb",{"type":"season","season":str(season["IndexNumber"])}).text = API().getArtwork(season, "Primary") if season.has_key("IndexNumber"):
SubElement(root, "thumb",{"type":"season","season":str(season["IndexNumber"])}).text = API().getArtwork(season, "Primary")
SubElement(root, "fanart").text = API().getArtwork(item, "Backdrop") SubElement(root, "fanart").text = API().getArtwork(item, "Backdrop")
SubElement(root, "title").text = utils.convertEncoding(item["Name"]) SubElement(root, "title").text = utils.convertEncoding(item["Name"])
SubElement(root, "originaltitle").text = utils.convertEncoding(item["Name"]) SubElement(root, "originaltitle").text = utils.convertEncoding(item["Name"])
SubElement(root, "sorttitle").text = utils.convertEncoding(item["SortName"]) SubElement(root, "sorttitle").text = utils.convertEncoding(item["SortName"])
@ -153,7 +153,6 @@ class CreateFiles():
if item_type == "Episode": if item_type == "Episode":
SubElement(root, "season").text = str(item.get("ParentIndexNumber")) SubElement(root, "season").text = str(item.get("ParentIndexNumber"))
SubElement(root, "episode").text = str(item.get("IndexNumber")) SubElement(root, "episode").text = str(item.get("IndexNumber"))
SubElement(root, "aired").text = str(item.get("ProductionYear"))
SubElement(root, "year").text = str(item.get("ProductionYear")) SubElement(root, "year").text = str(item.get("ProductionYear"))
if item.get("PremiereDate") != None: if item.get("PremiereDate") != None:
@ -161,6 +160,7 @@ class CreateFiles():
premieredate = premieredatelist[0] premieredate = premieredatelist[0]
SubElement(root, "firstaired").text = premieredate SubElement(root, "firstaired").text = premieredate
SubElement(root, "premiered").text = premieredate SubElement(root, "premiered").text = premieredate
SubElement(root, "aired").text = premieredate
if(timeInfo.get('Duration') != "0"): if(timeInfo.get('Duration') != "0"):
SubElement(root, "runtime").text = str(timeInfo.get('Duration')) SubElement(root, "runtime").text = str(timeInfo.get('Duration'))
@ -168,7 +168,7 @@ class CreateFiles():
SubElement(root, "plot").text = utils.convertEncoding(API().getOverview(item)) SubElement(root, "plot").text = utils.convertEncoding(API().getOverview(item))
if item.get("ShortOverview") != None: if item.get("ShortOverview") != None:
SubElement(root, "plotoutline").text = utils.convertEncoding(item.get("ShortOverview")) SubElement(root, "outline").text = utils.convertEncoding(item.get("ShortOverview"))
if item.get("TmdbCollectionName") != None: if item.get("TmdbCollectionName") != None:
SubElement(root, "set").text = item.get("TmdbCollectionName") SubElement(root, "set").text = item.get("TmdbCollectionName")
@ -178,8 +178,9 @@ class CreateFiles():
SubElement(root, "imdbnumber").text = item SubElement(root, "imdbnumber").text = item
if people.get("Writer") != None: if people.get("Writer") != None:
credits = SubElement(root, "credits")
for writer in people.get("Writer"): for writer in people.get("Writer"):
SubElement(root, "writer").text = utils.convertEncoding(writer) SubElement(credits, "writer").text = utils.convertEncoding(writer)
if people.get("Director") != None: if people.get("Director") != None:
for director in people.get("Director"): for director in people.get("Director"):

View file

@ -176,7 +176,7 @@ class WriteKodiDB():
changes = False changes = False
#update artwork #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,"clearlogo", API().getArtwork(MBitem, "Logo"),"tvshow")
changes = self.updateArtWork(KodiItem,"clearart", API().getArtwork(MBitem, "Art"),"tvshow") changes = self.updateArtWork(KodiItem,"clearart", API().getArtwork(MBitem, "Art"),"tvshow")
changes = self.updateArtWork(KodiItem,"banner", API().getArtwork(MBitem, "Banner"),"tvshow") changes = self.updateArtWork(KodiItem,"banner", API().getArtwork(MBitem, "Banner"),"tvshow")