From caa86fe5c8f24c5687de10f973b53e79f4e174be Mon Sep 17 00:00:00 2001 From: xnappo Date: Sat, 14 Mar 2015 11:06:37 -0500 Subject: [PATCH] Move getArt to API --- resources/lib/API.py | 133 ++++++++++++++++- resources/lib/DownloadUtils.py | 251 --------------------------------- resources/lib/LibrarySync.py | 30 ++-- resources/lib/PlaybackUtils.py | 20 +-- 4 files changed, 155 insertions(+), 279 deletions(-) diff --git a/resources/lib/API.py b/resources/lib/API.py index db796242..ed767059 100644 --- a/resources/lib/API.py +++ b/resources/lib/API.py @@ -2,9 +2,37 @@ # This class helps translate more complex cases from the MediaBrowser API to the XBMC API from datetime import datetime +import xbmc +import xbmcgui +import xbmcaddon class API(): - + logLevel = 0 + addonSettings = None + getString = None + LogCalls = False + TrackLog = "" + TotalUrlCalls = 0 + + def __init__(self, *args): + self.addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync') + self.getString = self.addonSettings.getLocalizedString + level = self.addonSettings.getSetting('logLevel') + self.logLevel = 0 + if(level != None and level != ""): + self.logLevel = int(level) + if(self.logLevel == 2): + self.LogCalls = True + + def logMsg(self, msg, level = 1): + if(self.logLevel >= level): + try: + xbmc.log("mb3sync DownloadUtils -> " + str(msg)) + except UnicodeEncodeError: + try: + xbmc.log("mb3sync DownloadUtils -> " + str(msg.encode('utf-8'))) + except: pass + def getPeople(self, item): # Process People director='' @@ -239,7 +267,7 @@ class API(): 'Episode' : tempEpisode, 'SeriesName' : SeriesName } - def getDate(self, item): + def getDateCreated(self, item): tempDate = item.get("DateCreated") if tempDate != None: tempDate = tempDate.split("T")[0] @@ -247,4 +275,103 @@ class API(): tempDate = date[2] + "." + date[1] + "." +date[0] else: tempDate = "01.01.2000" - return tempDate \ No newline at end of file + return tempDate + + def getArtwork(self, data, type, index = "0", userParentInfo = False): + + id = data.get("Id") + getSeriesData = False + userData = data.get("UserData") + + if type == "tvshow.poster": # Change the Id to the series to get the overall series poster + if data.get("Type") == "Season" or data.get("Type")== "Episode": + id = data.get("SeriesId") + getSeriesData = True + elif type == "poster" and data.get("Type") == "Episode" and self.addonSettings.getSetting('useSeasonPoster')=='true': # Change the Id to the Season to get the season poster + id = data.get("SeasonId") + if type == "poster" or type == "tvshow.poster": # Now that the Ids are right, change type to MB3 name + type="Primary" + if data.get("Type") == "Season": # For seasons: primary (poster), thumb and banner get season art, rest series art + if type != "Primary" and type != "Primary2" and type != "Primary3" and type != "Primary4" and type != "Thumb" and type != "Banner" and type!="Thumb3": + id = data.get("SeriesId") + getSeriesData = True + if data.get("Type") == "Episode": # For episodes: primary (episode thumb) gets episode art, rest series art. + if type != "Primary" and type != "Primary2" and type != "Primary3" and type != "Primary4": + id = data.get("SeriesId") + getSeriesData = True + if type =="Primary2" or type=="Primary3" or type=="Primary4": + id = data.get("SeasonId") + getSeriesData = True + if data.get("SeasonUserData") != None: + userData = data.get("SeasonUserData") + if id == None: + id=data.get("Id") + + imageTag = "e3ab56fe27d389446754d0fb04910a34" # a place holder tag, needs to be in this format + originalType = type + if type == "Primary2" or type == "Primary3" or type == "Primary4" or type=="SeriesPrimary": + type = "Primary" + if type == "Backdrop2" or type=="Backdrop3" or type=="BackdropNoIndicators": + type = "Backdrop" + if type == "Thumb2" or type=="Thumb3": + type = "Thumb" + if(data.get("ImageTags") != None and data.get("ImageTags").get(type) != None): + imageTag = data.get("ImageTags").get(type) + + if (data.get("Type") == "Episode" or data.get("Type") == "Season") and type=="Logo": + imageTag = data.get("ParentLogoImageTag") + if (data.get("Type") == "Episode" or data.get("Type") == "Season") and type=="Art": + imageTag = data.get("ParentArtImageTag") + if (data.get("Type") == "Episode") and originalType=="Thumb3": + imageTag = data.get("SeriesThumbImageTag") + if (data.get("Type") == "Season") and originalType=="Thumb3" and imageTag=="e3ab56fe27d389446754d0fb04910a34" : + imageTag = data.get("ParentThumbImageTag") + id = data.get("SeriesId") + + query = "" + height = "10000" + width = "10000" + played = "0" + totalbackdrops = 0 + + if originalType =="BackdropNoIndicators" and index == "0" and data.get("BackdropImageTags") != None: + totalbackdrops = len(data.get("BackdropImageTags")) + if totalbackdrops != 0: + index = str(randrange(0,totalbackdrops)) + # use the local image proxy server that is made available by this addons service + + port = self.addonSettings.getSetting('port') + host = self.addonSettings.getSetting('ipaddress') + server = host + ":" + port + + if self.addonSettings.getSetting('compressArt')=='true': + query = query + "&Quality=90" + + if imageTag == None: + imageTag = "e3ab56fe27d389446754d0fb04910a34" + artwork = "http://" + server + "/mediabrowser/Items/" + str(id) + "/Images/" + type + "/" + index + "/" + imageTag + "/original/" + width + "/" + height + "/" + played + "?" + query + if self.addonSettings.getSetting('disableCoverArt')=='true': + artwork = artwork + "&EnableImageEnhancers=false" + + self.logMsg("getArtwork : " + artwork, level=2) + + # do not return non-existing images + if ( (type!="Backdrop" and imageTag=="e3ab56fe27d389446754d0fb04910a34") | #Remember, this is the placeholder tag, meaning we didn't find a valid tag + (type=="Backdrop" and data.get("BackdropImageTags") != None and len(data.get("BackdropImageTags")) == 0) | + (type=="Backdrop" and data.get("BackdropImageTag") != None and len(data.get("BackdropImageTag")) == 0) + ): + if type != "Backdrop" or (type=="Backdrop" and getSeriesData==True and data.get("ParentBackdropImageTags") == None) or (type=="Backdrop" and getSeriesData!=True): + artwork='' + + return artwork + + def getUserArtwork(self, data, type, index = "0"): + + id = data.get("Id") + port = self.addonSettings.getSetting('port') + host = self.addonSettings.getSetting('ipaddress') + server = host + ":" + port + artwork = "http://" + server + "/mediabrowser/Users/" + str(id) + "/Images/" + type + "?Format=original" + + return artwork + \ No newline at end of file diff --git a/resources/lib/DownloadUtils.py b/resources/lib/DownloadUtils.py index 867de7ec..2d471b96 100644 --- a/resources/lib/DownloadUtils.py +++ b/resources/lib/DownloadUtils.py @@ -205,257 +205,6 @@ class DownloadUtils(): self.addonSettings.setSetting("userid" + username, "") return "" - def getArtwork(self, data, type, index = "0", userParentInfo = False): - - id = data.get("Id") - getSeriesData = False - userData = data.get("UserData") - - if type == "tvshow.poster": # Change the Id to the series to get the overall series poster - if data.get("Type") == "Season" or data.get("Type")== "Episode": - id = data.get("SeriesId") - getSeriesData = True - elif type == "poster" and data.get("Type") == "Episode" and self.addonSettings.getSetting('useSeasonPoster')=='true': # Change the Id to the Season to get the season poster - id = data.get("SeasonId") - if type == "poster" or type == "tvshow.poster": # Now that the Ids are right, change type to MB3 name - type="Primary" - if data.get("Type") == "Season": # For seasons: primary (poster), thumb and banner get season art, rest series art - if type != "Primary" and type != "Primary2" and type != "Primary3" and type != "Primary4" and type != "Thumb" and type != "Banner" and type!="Thumb3": - id = data.get("SeriesId") - getSeriesData = True - if data.get("Type") == "Episode": # For episodes: primary (episode thumb) gets episode art, rest series art. - if type != "Primary" and type != "Primary2" and type != "Primary3" and type != "Primary4": - id = data.get("SeriesId") - getSeriesData = True - if type =="Primary2" or type=="Primary3" or type=="Primary4": - id = data.get("SeasonId") - getSeriesData = True - if data.get("SeasonUserData") != None: - userData = data.get("SeasonUserData") - if id == None: - id=data.get("Id") - - imageTag = "e3ab56fe27d389446754d0fb04910a34" # a place holder tag, needs to be in this format - originalType = type - if type == "Primary2" or type == "Primary3" or type == "Primary4" or type=="SeriesPrimary": - type = "Primary" - if type == "Backdrop2" or type=="Backdrop3" or type=="BackdropNoIndicators": - type = "Backdrop" - if type == "Thumb2" or type=="Thumb3": - type = "Thumb" - if(data.get("ImageTags") != None and data.get("ImageTags").get(type) != None): - imageTag = data.get("ImageTags").get(type) - - if (data.get("Type") == "Episode" or data.get("Type") == "Season") and type=="Logo": - imageTag = data.get("ParentLogoImageTag") - if (data.get("Type") == "Episode" or data.get("Type") == "Season") and type=="Art": - imageTag = data.get("ParentArtImageTag") - if (data.get("Type") == "Episode") and originalType=="Thumb3": - imageTag = data.get("SeriesThumbImageTag") - if (data.get("Type") == "Season") and originalType=="Thumb3" and imageTag=="e3ab56fe27d389446754d0fb04910a34" : - imageTag = data.get("ParentThumbImageTag") - id = data.get("SeriesId") - - query = "" - height = "10000" - width = "10000" - played = "0" - totalbackdrops = 0 - - if self.addonSettings.getSetting('showArtIndicators')=='true': # add watched, unplayedcount and percentage played indicators to posters - if (originalType =="Primary" or originalType =="Backdrop" or originalType =="Banner") and data.get("Type") != "Episode": - if originalType =="Backdrop" and index == "0" and data.get("BackdropImageTags") != None: - totalbackdrops = len(data.get("BackdropImageTags")) - if totalbackdrops != 0: - index = str(randrange(0,totalbackdrops)) - if userData != None: - - UnWatched = 0 if userData.get("UnplayedItemCount")==None else userData.get("UnplayedItemCount") - - if UnWatched <> 0 and self.addonSettings.getSetting('showUnplayedIndicators')=='true': - query = query + "&UnplayedCount=" + str(UnWatched) - - - if(userData != None and userData.get("Played") == True and self.addonSettings.getSetting('showWatchedIndicators')=='true'): - query = query + "&AddPlayedIndicator=true" - - PlayedPercentage = 0 if userData.get("PlayedPercentage")==None else userData.get("PlayedPercentage") - if PlayedPercentage == 0 and userData!=None and userData.get("PlayedPercentage")!=None : - PlayedPercentage = userData.get("PlayedPercentage") - if (PlayedPercentage != 100 or PlayedPercentage) != 0 and self.addonSettings.getSetting('showPlayedPrecentageIndicators')=='true': - played = str(PlayedPercentage) - - elif originalType =="Primary2": - if userData != None: - - UnWatched = 0 if userData.get("UnplayedItemCount")==None else userData.get("UnplayedItemCount") - - if UnWatched <> 0 and self.addonSettings.getSetting('showUnplayedIndicators')=='true': - query = query + "&UnplayedCount=" + str(UnWatched) - - if(userData != None and userData.get("Played") == True and self.addonSettings.getSetting('showWatchedIndicators')=='true'): - query = query + "&AddPlayedIndicator=true" - - PlayedPercentage = 0 if userData.get("PlayedPercentage")==None else userData.get("PlayedPercentage") - if PlayedPercentage == 0 and userData!=None and userData.get("PlayedPercentage")!=None : - PlayedPercentage = userData.get("PlayedPercentage") - if (PlayedPercentage != 100 or PlayedPercentage) != 0 and self.addonSettings.getSetting('showPlayedPrecentageIndicators')=='true': - played = str(PlayedPercentage) - - height = "338" - width = "226" - - elif originalType =="Primary3" or originalType == "SeriesPrimary": - if userData != None: - - UnWatched = 0 if userData.get("UnplayedItemCount")==None else userData.get("UnplayedItemCount") - - if UnWatched <> 0 and self.addonSettings.getSetting('showUnplayedIndicators')=='true': - query = query + "&UnplayedCount=" + str(UnWatched) - - if(userData != None and userData.get("Played") == True and self.addonSettings.getSetting('showWatchedIndicators')=='true'): - query = query + "&AddPlayedIndicator=true" - - PlayedPercentage = 0 if userData.get("PlayedPercentage")==None else userData.get("PlayedPercentage") - if PlayedPercentage == 0 and userData!=None and userData.get("PlayedPercentage")!=None : - PlayedPercentage = userData.get("PlayedPercentage") - if (PlayedPercentage != 100 or PlayedPercentage) != 0 and self.addonSettings.getSetting('showPlayedPrecentageIndicators')=='true': - played = str(PlayedPercentage) - - - - elif originalType =="Primary4": - if userData != None: - - UnWatched = 0 if userData.get("UnplayedItemCount")==None else userData.get("UnplayedItemCount") - - if UnWatched <> 0 and self.addonSettings.getSetting('showUnplayedIndicators')=='true': - query = query + "&UnplayedCount=" + str(UnWatched) - - if(userData != None and userData.get("Played") == True and self.addonSettings.getSetting('showWatchedIndicators')=='true'): - query = query + "&AddPlayedIndicator=true" - - PlayedPercentage = 0 if userData.get("PlayedPercentage")==None else userData.get("PlayedPercentage") - if PlayedPercentage == 0 and userData!=None and userData.get("PlayedPercentage")!=None : - PlayedPercentage = userData.get("PlayedPercentage") - if (PlayedPercentage != 100 or PlayedPercentage) != 0 and self.addonSettings.getSetting('showPlayedPrecentageIndicators')=='true': - played = str(PlayedPercentage) - - height = "270" - width = "180" - - elif type =="Primary" and data.get("Type") == "Episode": - if userData != None: - - UnWatched = 0 if userData.get("UnplayedItemCount")==None else userData.get("UnplayedItemCount") - - if UnWatched <> 0 and self.addonSettings.getSetting('showUnplayedIndicators')=='true': - query = query + "&UnplayedCount=" + str(UnWatched) - - if(userData != None and userData.get("Played") == True and self.addonSettings.getSetting('showWatchedIndicators')=='true'): - query = query + "&AddPlayedIndicator=true" - - PlayedPercentage = 0 if userData.get("PlayedPercentage")==None else userData.get("PlayedPercentage") - if PlayedPercentage == 0 and userData!=None and userData.get("PlayedPercentage")!=None : - PlayedPercentage = userData.get("PlayedPercentage") - if (PlayedPercentage != 100 or PlayedPercentage) != 0 and self.addonSettings.getSetting('showPlayedPrecentageIndicators')=='true': - played = str(PlayedPercentage) - - height = "410" - width = "770" - - - elif originalType =="Backdrop2" or originalType =="Thumb2" and data.get("Type") != "Episode": - if originalType =="Backdrop2" and data.get("BackdropImageTags") != None: - totalbackdrops = len(data.get("BackdropImageTags")) - if totalbackdrops != 0: - index = str(randrange(0,totalbackdrops)) - if userData != None: - - UnWatched = 0 if userData.get("UnplayedItemCount")==None else userData.get("UnplayedItemCount") - - if UnWatched <> 0 and self.addonSettings.getSetting('showUnplayedIndicators')=='true': - query = query + "&UnplayedCount=" + str(UnWatched) - - if(userData != None and userData.get("Played") == True and self.addonSettings.getSetting('showWatchedIndicators')=='true'): - query = query + "&AddPlayedIndicator=true" - - PlayedPercentage = 0 if userData.get("PlayedPercentage")==None else userData.get("PlayedPercentage") - if PlayedPercentage == 0 and userData!=None and userData.get("PlayedPercentage")!=None : - PlayedPercentage = userData.get("PlayedPercentage") - if (PlayedPercentage != 100 or PlayedPercentage) != 0 and self.addonSettings.getSetting('showPlayedPrecentageIndicators')=='true': - played = str(PlayedPercentage) - - height = "370" - width = "660" - - elif originalType =="Backdrop3" or originalType =="Thumb3" and data.get("Type") != "Episode": - if originalType =="Backdrop3" and data.get("BackdropImageTags") != None: - totalbackdrops = len(data.get("BackdropImageTags")) - if totalbackdrops != 0: - index = str(randrange(0,totalbackdrops)) - if userData != None: - - UnWatched = 0 if userData.get("UnplayedItemCount")==None else userData.get("UnplayedItemCount") - - if UnWatched <> 0 and self.addonSettings.getSetting('showUnplayedIndicators')=='true': - query = query + "&UnplayedCount=" + str(UnWatched) - - if(userData != None and userData.get("Played") == True and self.addonSettings.getSetting('showWatchedIndicators')=='true'): - query = query + "&AddPlayedIndicator=true" - - PlayedPercentage = 0 if userData.get("PlayedPercentage")==None else userData.get("PlayedPercentage") - if PlayedPercentage == 0 and userData!=None and userData.get("PlayedPercentage")!=None : - PlayedPercentage = userData.get("PlayedPercentage") - if (PlayedPercentage != 100 or PlayedPercentage) != 0 and self.addonSettings.getSetting('showPlayedPrecentageIndicators')=='true': - played = str(PlayedPercentage) - - height = "910" - width = "1620" - - if originalType =="BackdropNoIndicators" and index == "0" and data.get("BackdropImageTags") != None: - totalbackdrops = len(data.get("BackdropImageTags")) - if totalbackdrops != 0: - index = str(randrange(0,totalbackdrops)) - # use the local image proxy server that is made available by this addons service - - port = self.addonSettings.getSetting('port') - host = self.addonSettings.getSetting('ipaddress') - server = host + ":" + port - - if self.addonSettings.getSetting('compressArt')=='true': - query = query + "&Quality=90" - - if imageTag == None: - imageTag = "e3ab56fe27d389446754d0fb04910a34" - artwork = "http://" + server + "/mediabrowser/Items/" + str(id) + "/Images/" + type + "/" + index + "/" + imageTag + "/original/" + width + "/" + height + "/" + played + "?" + query - if self.addonSettings.getSetting('disableCoverArt')=='true': - artwork = artwork + "&EnableImageEnhancers=false" - - self.logMsg("getArtwork : " + artwork, level=2) - - # do not return non-existing images - if ( (type!="Backdrop" and imageTag=="e3ab56fe27d389446754d0fb04910a34") | #Remember, this is the placeholder tag, meaning we didn't find a valid tag - (type=="Backdrop" and data.get("BackdropImageTags") != None and len(data.get("BackdropImageTags")) == 0) | - (type=="Backdrop" and data.get("BackdropImageTag") != None and len(data.get("BackdropImageTag")) == 0) - ): - if type != "Backdrop" or (type=="Backdrop" and getSeriesData==True and data.get("ParentBackdropImageTags") == None) or (type=="Backdrop" and getSeriesData!=True): - artwork='' - - return artwork - - def getUserArtwork(self, data, type, index = "0"): - - id = data.get("Id") - - port = self.addonSettings.getSetting('port') - host = self.addonSettings.getSetting('ipaddress') - server = host + ":" + port - - artwork = "http://" + server + "/mediabrowser/Users/" + str(id) + "/Images/" + type + "?Format=original" - - return artwork - def imageUrl(self, id, type, index, width, height): port = self.addonSettings.getSetting('port') diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index f8c69080..459f06f1 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -140,17 +140,17 @@ class LibrarySync(): genre = API().getGenre(MBitem) mediaStreams=API().getMediaStreams(MBitem) - thumbPath = downloadUtils.getArtwork(MBitem, "Primary") + thumbPath = API().getArtwork(MBitem, "Primary") utils.logMsg("Updating item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"]) #update artwork - self.updateArtWork(KodiItem,"poster", downloadUtils.getArtwork(MBitem, "poster"),"movie") - self.updateArtWork(KodiItem,"clearlogo", downloadUtils.getArtwork(MBitem, "Logo"),"movie") - self.updateArtWork(KodiItem,"banner", downloadUtils.getArtwork(MBitem, "Banner"),"movie") - self.updateArtWork(KodiItem,"landscape", downloadUtils.getArtwork(MBitem, "Thumb"),"movie") - self.updateArtWork(KodiItem,"discart", downloadUtils.getArtwork(MBitem, "Disc"),"movie") - self.updateArtWork(KodiItem,"fanart", downloadUtils.getArtwork(MBitem, "Backdrop"),"movie") + self.updateArtWork(KodiItem,"poster", API().getArtwork(MBitem, "poster"),"movie") + self.updateArtWork(KodiItem,"clearlogo", API().getArtwork(MBitem, "Logo"),"movie") + self.updateArtWork(KodiItem,"banner", API().getArtwork(MBitem, "Banner"),"movie") + self.updateArtWork(KodiItem,"landscape", API().getArtwork(MBitem, "Thumb"),"movie") + self.updateArtWork(KodiItem,"discart", API().getArtwork(MBitem, "Disc"),"movie") + self.updateArtWork(KodiItem,"fanart", API().getArtwork(MBitem, "Backdrop"),"movie") #update common properties duration = (int(timeInfo.get('Duration'))*60) @@ -271,8 +271,8 @@ class LibrarySync(): root = Element("movie") SubElement(root, "id").text = item["Id"] SubElement(root, "tag").text = "all mediabrowser movies" # TODO --> use tags to assign user view - SubElement(root, "thumb").text = downloadUtils.getArtwork(item, "poster") - SubElement(root, "fanart").text = downloadUtils.getArtwork(item, "Backdrop") + SubElement(root, "thumb").text = API().getArtwork(item, "poster") + SubElement(root, "fanart").text = API().getArtwork(item, "Backdrop") SubElement(root, "title").text = item["Name"].encode('utf-8').decode('utf-8') SubElement(root, "originaltitle").text = item["Name"].encode('utf-8').decode('utf-8') @@ -294,12 +294,12 @@ class LibrarySync(): SubElement(root, "plot").text = API().getOverview(item).decode('utf-8') art = SubElement(root, "art") - SubElement(art, "poster").text = downloadUtils.getArtwork(item, "poster") - SubElement(art, "fanart").text = downloadUtils.getArtwork(item, "Backdrop") - SubElement(art, "landscape").text = downloadUtils.getArtwork(item, "Thumb") - SubElement(art, "clearlogo").text = downloadUtils.getArtwork(item, "Logo") - SubElement(art, "discart").text = downloadUtils.getArtwork(item, "Disc") - SubElement(art, "banner").text = downloadUtils.getArtwork(item, "Banner") + SubElement(art, "poster").text = API().getArtwork(item, "poster") + SubElement(art, "fanart").text = API().getArtwork(item, "Backdrop") + SubElement(art, "landscape").text = API().getArtwork(item, "Thumb") + SubElement(art, "clearlogo").text = API().getArtwork(item, "Logo") + SubElement(art, "discart").text = API().getArtwork(item, "Disc") + SubElement(art, "banner").text = API().getArtwork(item, "Banner") ET.ElementTree(root).write(nfoFile, encoding="utf-8", xml_declaration=True) diff --git a/resources/lib/PlaybackUtils.py b/resources/lib/PlaybackUtils.py index 949fdc7b..a9012fc3 100644 --- a/resources/lib/PlaybackUtils.py +++ b/resources/lib/PlaybackUtils.py @@ -57,7 +57,7 @@ class PlaybackUtils(): playurl = PlayUtils().getPlayUrl(server, id, result) xbmc.log("Play URL: " + playurl) - thumbPath = downloadUtils.getArtwork(result, "Primary") + thumbPath = API.getArtwork(result, "Primary") listItem = xbmcgui.ListItem(path=playurl, iconImage=thumbPath, thumbnailImage=thumbPath) self.setListItemProps(server, id, listItem, result) @@ -129,15 +129,15 @@ class PlaybackUtils(): eppNum = result.get("IndexNumber") tvshowTitle = result.get("SeriesName") - self.setArt(listItem,'poster', downloadUtils.getArtwork(result, "Primary")) - self.setArt(listItem,'tvshow.poster', downloadUtils.getArtwork(result, "SeriesPrimary")) - self.setArt(listItem,'clearart', downloadUtils.getArtwork(result, "Art")) - self.setArt(listItem,'tvshow.clearart', downloadUtils.getArtwork(result, "Art")) - self.setArt(listItem,'clearlogo', downloadUtils.getArtwork(result, "Logo")) - self.setArt(listItem,'tvshow.clearlogo', downloadUtils.getArtwork(result, "Logo")) - self.setArt(listItem,'discart', downloadUtils.getArtwork(result, "Disc")) - self.setArt(listItem,'fanart_image', downloadUtils.getArtwork(result, "Backdrop")) - self.setArt(listItem,'landscape', downloadUtils.getArtwork(result, "Thumb")) + self.setArt(listItem,'poster', API.getArtwork(result, "Primary")) + self.setArt(listItem,'tvshow.poster', API.getArtwork(result, "SeriesPrimary")) + self.setArt(listItem,'clearart', API.getArtwork(result, "Art")) + self.setArt(listItem,'tvshow.clearart', API.getArtwork(result, "Art")) + self.setArt(listItem,'clearlogo', API.getArtwork(result, "Logo")) + self.setArt(listItem,'tvshow.clearlogo', API.getArtwork(result, "Logo")) + self.setArt(listItem,'discart', API.getArtwork(result, "Disc")) + self.setArt(listItem,'fanart_image', API.getArtwork(result, "Backdrop")) + self.setArt(listItem,'landscape', API.getArtwork(result, "Thumb")) listItem.setProperty('IsPlayable', 'true') listItem.setProperty('IsFolder', 'false')