Skip to content

Commit

Permalink
Merge pull request #154 from edwardslabs/tvdb_error
Browse files Browse the repository at this point in the history
Tvdb error
  • Loading branch information
dmptrluke committed Apr 13, 2015
2 parents 2eb233a + 1b78050 commit e62da4a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugins/tvdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ def get_episodes_for_series(series_name, api_key):
return res

series = etree.fromstring(_request.content, parser=parser)
series_name = series.xpath('//SeriesName/text()')[0]

if series.xpath('//Status/text()')[0] == 'Ended':
res["ended"] = True
try:
series_name = series.xpath('//SeriesName/text()')[0]
except:
series_name = series.xpath('//SeriesName/text()')
try:
if series.xpath('//Status/text()')[0] == 'Ended':
res["ended"] = True
except:
if series.xpath('//Status/text()') == 'Ended':
res["ended"] = True

res["episodes"] = series.xpath('//Episode')
res["name"] = series_name
Expand Down

0 comments on commit e62da4a

Please sign in to comment.