From 4a1bd80093c5394e51ccb6902f52fe853861a8a3 Mon Sep 17 00:00:00 2001 From: im85288 Date: Thu, 19 Mar 2015 21:31:06 +0000 Subject: [PATCH] added season posters --- resources/lib/CreateFiles.py | 6 ++++++ resources/lib/ReadEmbyDB.py | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/resources/lib/CreateFiles.py b/resources/lib/CreateFiles.py index 2dd3eadc..3e1cfdc5 100644 --- a/resources/lib/CreateFiles.py +++ b/resources/lib/CreateFiles.py @@ -113,6 +113,12 @@ class CreateFiles(): SubElement(root, "tag").text = tag SubElement(root, "thumb").text = API().getArtwork(item, "Primary") + if item_type == 'Series': + seasonData = ReadEmbyDB().getTVShowSeasons(item["Id"]) + if seasonData != None: + for season in seasonData: + SubElement(root, "thumb",{"type":"season","season":str(season["IndexNumber"])}).text = API().getArtwork(season, "Primary") + SubElement(root, "fanart").text = API().getArtwork(item, "Backdrop") diff --git a/resources/lib/ReadEmbyDB.py b/resources/lib/ReadEmbyDB.py index 6c3299dd..78479d35 100644 --- a/resources/lib/ReadEmbyDB.py +++ b/resources/lib/ReadEmbyDB.py @@ -87,6 +87,27 @@ class ReadEmbyDB(): result = result['Items'] return result + + def getTVShowSeasons(self, tvShowId): + result = None + + addon = xbmcaddon.Addon(id='plugin.video.mb3sync') + port = addon.getSetting('port') + host = addon.getSetting('ipaddress') + server = host + ":" + port + + downloadUtils = DownloadUtils() + userid = downloadUtils.getUserId() + + url = 'http://' + server + '/Shows/' + tvShowId + '/Seasons?UserId=' + userid + '&format=json&ImageTypeLimit=1' + + jsonData = downloadUtils.downloadUrl(url, suppress=True, popup=0) + if jsonData != None and jsonData != "": + result = json.loads(jsonData) + if(result.has_key('Items')): + result = result['Items'] + + return result def getEpisodes(self, showId, fullinfo = False): result = None