Fix IndexError e.g. for channels if stream info missing
This commit is contained in:
parent
02ba51bc15
commit
14fc334422
1 changed files with 10 additions and 2 deletions
|
@ -1754,8 +1754,16 @@ class API():
|
||||||
videotracks = []
|
videotracks = []
|
||||||
audiotracks = []
|
audiotracks = []
|
||||||
subtitlelanguages = []
|
subtitlelanguages = []
|
||||||
# Sometimes, aspectratio is on the "toplevel"
|
try:
|
||||||
aspectratio = self.item[0].attrib.get('aspectRatio', None)
|
# Sometimes, aspectratio is on the "toplevel"
|
||||||
|
aspectratio = self.item[0].attrib.get('aspectRatio', None)
|
||||||
|
except IndexError:
|
||||||
|
# There is no stream info at all, returning empty
|
||||||
|
return {
|
||||||
|
'video': videotracks,
|
||||||
|
'audio': audiotracks,
|
||||||
|
'subtitle': subtitlelanguages
|
||||||
|
}
|
||||||
# TODO: what if several Media tags exist?!?
|
# TODO: what if several Media tags exist?!?
|
||||||
# Loop over parts
|
# Loop over parts
|
||||||
for child in self.item[0]:
|
for child in self.item[0]:
|
||||||
|
|
Loading…
Reference in a new issue