Skip to content

Commit 543a4c3

Browse files
committed
Handle when SeriesName/text() is not a list
1 parent d6c2182 commit 543a4c3

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

plugins/tvdb.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ def get_episodes_for_series(series_name, api_key):
4040
return res
4141

4242
series = etree.fromstring(_request.content, parser=parser)
43-
series_name = series.xpath('//SeriesName/text()')[0]
44-
45-
if series.xpath('//Status/text()')[0] == 'Ended':
46-
res["ended"] = True
43+
try:
44+
series_name = series.xpath('//SeriesName/text()')[0]
45+
if series.xpath('//Status/text()')[0] == 'Ended':
46+
res["ended"] = True
47+
except:
48+
series_name = series.xpath('//SeriesName/text()')
49+
if series.xpath('//Status/text()') == 'Ended':
50+
res["ended"] = True
4751

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

0 commit comments

Comments
 (0)