Fix error when Series missing 'episodeFileCount' or 'episodeCount' (#15824)

* Fix error when Series missing 'episodeFileCount' or 'episodeCount'

* Update sonarr.py

* Update sonarr.py
pull/15857/head
psike 2018-08-06 13:18:36 +03:00 committed by Paulus Schoutsen
parent 9cfe0db3c8
commit 6031801206
1 changed files with 6 additions and 2 deletions

View File

@ -158,6 +158,10 @@ class SonarrSensor(Entity):
)
elif self.type == 'series':
for show in self.data:
if 'episodeFileCount' not in show \
or 'episodeCount' not in show:
attributes[show['title']] = 'N/A'
else:
attributes[show['title']] = '{}/{} Episodes'.format(
show['episodeFileCount'], show['episodeCount'])
elif self.type == 'status':