Skip to content

Commit

Permalink
Merge pull request #25 from mkanet/master
Browse files Browse the repository at this point in the history
Added Sonarr V4 support. Added deep_link attribute.
  • Loading branch information
mkanet authored Feb 1, 2024
2 parents f2de40e + d2c93a4 commit 2b580e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/sonarr_upcoming_media/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "sonarr_upcoming_media",
"name": "Sonarr Upcoming Media",
"version": "0.2.7",
"version": "0.2.8",
"documentation": "https://github.com/custom-components/sensor.sonarr_upcoming_media",
"dependencies": [],
"codeowners": ["@maykar"],
Expand Down
11 changes: 7 additions & 4 deletions custom_components/sonarr_upcoming_media/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,19 @@ def extra_state_attributes(self):
try:
for img in show['series']['images']:
if img['coverType'] == 'poster':
card_item['poster'] = re.sub('.jpg', '_t.jpg', img['url'])
card_item['poster'] = re.sub('.jpg', '_t.jpg', img['remoteUrl'])
except:
continue
try:
card_item['fanart'] = ''
for img in show['series']['images']:
if img['coverType'] == 'fanart':
card_item['fanart'] = re.sub('.jpg', '_t.jpg', img['url'])
card_item['fanart'] = re.sub('.jpg', '_t.jpg', img['remoteUrl'])
except:
pass
series_title = show['series']['title']
series_slug = series_title.lower().replace(' ', '-')
card_item['deep_link'] = f'http://{self.host}:{self.port}/series/{series_slug}'
card_json.append(card_item)
attributes['data'] = card_json
return attributes
Expand All @@ -139,8 +142,8 @@ def update(self):
start = get_date(self._tz)
end = get_date(self._tz, self.days)
try:
api = requests.get('http{0}://{1}:{2}/{3}api/calendar?start={4}'
'&end={5}'.format(self.ssl, self.host,
api = requests.get('http{0}://{1}:{2}/{3}api/v3/calendar?start={4}'
'&end={5}&includeEpisodeImages=true&includeSeries=true'.format(self.ssl, self.host,
self.port, self.urlbase,
start, end),
headers={'X-Api-Key': self.apikey}, timeout=10)
Expand Down

0 comments on commit 2b580e1

Please sign in to comment.