Thank you for taking the time to respond!
Good point with respect to using the Sonarr pics.
Would it be possible to use the Art that Kodi houses then? This (see below) is actually how I coded it in Python (please excuse the horrible code, as Python isn’t in my top 5 languages used. It was a quick hack to get the desired result).
In short, the below Python code will:
- Find the show in Kodi
- Find the current season’s Art (if not found, get the show’s “overall” Art (as known by Kodi)
- Pop a notification with the URL we retrieved/built from Kodi’s responses
#Get the show
showDetailsRequest='{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["title","thumbnail"], "sort": {"order": "descending", "method": "lastplayed"}, "filter":{"field":"title","operator":"startswith","value":"'+showName+'"}} , "id": 1}'
showDetailsRequest_enc=urlStr+urllib.quote(showDetailsRequest)
try:
fileHandle = urllib2.urlopen(showDetailsRequest_enc)
showDetails_response = fileHandle.read()
fileHandle.close()
except IOError:
print 'Cannot <strong class="highlight">open</strong> <strong class="highlight">URL</strong> %s for reading' % urlPayload
showDetails_response='['+showDetails_response+']'
showDetails_response = unicode(showDetails_response, 'utf-8', errors='ignore')
json_response=simplejson.loads(showDetails_response)
masterThumbnail = ""
if json_response[0]['result'].has_key('tvshows'):
item = json_response[0]['result']['tvshows']
tvshowid = item[0]['tvshowid']
tvshowid_str=str(tvshowid)
masterThumbnail = item[0]['thumbnail']
else:
return
#Get the season details for show
#We need to limit the search so we only get the season we're interested in back
prevseasonnumber=seasonnumber - 1
prevseasonnumber_str=str(prevseasonnumber)
showSeasonsRequest='{"jsonrpc": "2.0", "method": "VideoLibrary.GetSeasons", "params": {"properties": ["season", "thumbnail"], "tvshowid":'+tvshowid_str+',"limits":{"start":'+prevseasonnumber_str+',"end":'+seasonnumber_str+'}}, "id": 1}'
showSeasonsRequest_enc=urlStr+urllib.quote(showSeasonsRequest)
showSeasonsRequest_enc = unicode(showSeasonsRequest_enc, 'utf-8', errors='ignore')
try:
fileHandle = urllib2.urlopen(showSeasonsRequest_enc)
showSeasons_response = fileHandle.read()
fileHandle.close()
except IOError:
print 'Cannot <strong class="highlight">open</strong> <strong class="highlight">URL</strong> %s for reading' % urlPayload
showSeasons_response='['+showSeasons_response+']'
showSeasons_response = unicode(showSeasons_response, 'utf-8', errors='ignore')
json_response=simplejson.loads(showSeasons_response)
seasonThumbnail = ""
try:
if json_response[0]['result'].has_key('seasons'):
seasonThumbnail = item[0]['thumbnail']
except:
print 'Exception Error reading XML - Likely no Seasons element'
if seasonThumbnail <> "":
urlImage = seasonThumbnail
else:
urlImage = masterThumbnail
#ImagePath = re.search('%s(.*)%s' % ('image://', ''), urlImage).group(1)
#Remove trailing '/' if any... (Just startd appearing)...
urlImage=urlImage.rstrip('/')
#Need to remove the image:// or XBMC doesn't show the picture
urlImage = re.sub('image://','',urlImage, flags=re.IGNORECASE)
if urlImage<>'':
urlImage='http://127.0.0.1:8080/image/'+urlImage
showAddedRequest='{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Just Added","message":"'+episodeMsg+'","image":"'+urlImage+'","displaytime":20000},"id":1}'
else:
showAddedRequest='{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Just Added","message":"'+episodeMsg+'","displaytime":20000},"id":1}'
showAddedRequest_enc=urllib.quote(showAddedRequest)
showAddedRequest_enc = unicode(showAddedRequest_enc, 'utf-8', errors='ignore')
print urlImage
print showAddedRequest
urlPayload=urlStr+showAddedRequest_enc
try:
fileHandle = urllib2.urlopen(urlPayload)
fileHandle.close()
except IOError:
print 'Cannot <strong class="highlight">open</strong> <strong class="highlight">URL</strong> %s for reading' % urlPayload
str1 = 'error!'
return None