Skip to content

Commit

Permalink
Check image type as sonarr changed order of images
Browse files Browse the repository at this point in the history
  • Loading branch information
maykar authored May 17, 2020
1 parent 74a5b2e commit 5e37396
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions custom_components/sonarr_upcoming_media/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ def device_state_attributes(self):
else:
card_item['genres'] = ''
try:
card_item['poster'] = re.sub('.jpg', '_t.jpg',
show['series']['images'][2]['url'])
for img in show['series']['images']:
if img['coverType'] == 'poster':
card_item['poster'] = re.sub('.jpg', '_t.jpg', img['url'])
except:
continue
try:
if '.jpg' in show['series']['images'][0]['url']:
card_item['fanart'] = re.sub('.jpg', '_t.jpg',
show['series']['images'][0]['url'])
else:
card_item['fanart'] = ''
card_item['fanart'] = ''
for img in show['series']['images']:
if img['coverType'] == 'fanart':
card_item['fanart'] = re.sub('.jpg', '_t.jpg', img['url'])
except:
pass
card_json.append(card_item)
Expand Down

0 comments on commit 5e37396

Please sign in to comment.