1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-01-08 14:17:54 +01:00

Loop all subtitles for Viafree

This commit is contained in:
David Pedersen 2019-07-02 12:54:27 +02:00
parent 4569db53ce
commit 3ee59f9423

View File

@ -312,32 +312,19 @@ class TVPlayIE(InfoExtractor):
# TODO: webvtt in m3u8 # TODO: webvtt in m3u8
subtitles = {} subtitles = {}
sami_path = video.get('sami_path') sub_paths = [
if sami_path: video.get('sami_path'),
lang = self._search_regex( video.get('subtitles_webvtt'),
r'_([a-z]{2})\.xml', sami_path, 'lang', video.get('subtitles_for_hearing_impaired'),
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1]) ]
subtitles[lang] = [{ for path in sub_paths:
'url': sami_path, if path:
}] lang = self._search_regex(
r'_(.*)(\.)', path, 'lang',
subtitles_webvtt = video.get('subtitles_webvtt') default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
if subtitles_webvtt: subtitles[lang] = [{
lang = self._search_regex( 'url': path,
r'_([a-z]{2})\.vtt', subtitles_webvtt, 'lang', }]
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
subtitles[lang] = [{
'url': subtitles_webvtt,
}]
subtitles_for_hearing_impaired = video.get('subtitles_for_hearing_impaired')
if subtitles_for_hearing_impaired:
lang = self._search_regex(
r'_([a-z]{2})_', subtitles_for_hearing_impaired, 'lang',
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
subtitles[lang + '_sdh'] = [{
'url': subtitles_for_hearing_impaired,
}]
series = video.get('format_title') series = video.get('format_title')
episode_number = int_or_none(video.get('format_position', {}).get('episode')) episode_number = int_or_none(video.get('format_position', {}).get('episode'))