1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

Simplify modified subtitle handling

This commit is contained in:
dirkf 2020-10-14 11:55:03 +00:00 committed by GitHub
parent 9b74c4b7db
commit 7671a9442c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -351,7 +351,7 @@ class BBCCoUkIE(InfoExtractor):
def _download_media_selector(self, programme_id): def _download_media_selector(self, programme_id):
last_exception = None last_exception = None
formats = [] formats = []
subtitles = [] subtitles = None
# as some mediaselectors may be parseable but have # as some mediaselectors may be parseable but have
# no formats (eg captions only), try all possible # no formats (eg captions only), try all possible
# mediaselectors # mediaselectors
@ -364,12 +364,10 @@ class BBCCoUkIE(InfoExtractor):
formats += formatsAndSubtitles[0] formats += formatsAndSubtitles[0]
# subtitles subtitles (a dict {(lang,sttl)}) # subtitles subtitles (a dict {(lang,sttl)})
if formatsAndSubtitles[1]: if formatsAndSubtitles[1]:
if not subtitles: if subtitles:
subtitles = formatsAndSubtitles[1]
else:
# prioritise the first sttl for each lang # prioritise the first sttl for each lang
formatsAndSubtitles[1].update(subtitles) formatsAndSubtitles[1].update(subtitles)
subtitles = formatsAndSubtitles[1] subtitles = formatsAndSubtitles[1]
except BBCCoUkIE.MediaSelectionError as e: except BBCCoUkIE.MediaSelectionError as e:
if e.id in ('notukerror', 'geolocation', 'selectionunavailable'): if e.id in ('notukerror', 'geolocation', 'selectionunavailable'):
last_exception = e last_exception = e