Fix error when Series missing 'episodeFileCount' or 'episodeCount' (#15824)
* Fix error when Series missing 'episodeFileCount' or 'episodeCount' * Update sonarr.py * Update sonarr.pypull/15857/head
parent
9cfe0db3c8
commit
6031801206
|
@ -158,8 +158,12 @@ class SonarrSensor(Entity):
|
||||||
)
|
)
|
||||||
elif self.type == 'series':
|
elif self.type == 'series':
|
||||||
for show in self.data:
|
for show in self.data:
|
||||||
attributes[show['title']] = '{}/{} Episodes'.format(
|
if 'episodeFileCount' not in show \
|
||||||
show['episodeFileCount'], show['episodeCount'])
|
or 'episodeCount' not in show:
|
||||||
|
attributes[show['title']] = 'N/A'
|
||||||
|
else:
|
||||||
|
attributes[show['title']] = '{}/{} Episodes'.format(
|
||||||
|
show['episodeFileCount'], show['episodeCount'])
|
||||||
elif self.type == 'status':
|
elif self.type == 'status':
|
||||||
attributes = self.data
|
attributes = self.data
|
||||||
return attributes
|
return attributes
|
||||||
|
|
Loading…
Reference in New Issue