Fix youtube captions that disappeared with multi-language caption support
[BLD-889]
This commit is contained in:
committed by
Adam Palay
parent
4db7885336
commit
287d84ba95
@@ -245,21 +245,23 @@ class VideoModule(VideoFields, XModule):
|
||||
elif self.sub:
|
||||
track_url = self.runtime.handler_url(self, 'transcript').rstrip('/?') + '/download'
|
||||
|
||||
if self.transcript_language in self.transcripts:
|
||||
transcript_language = self.transcript_language
|
||||
elif self.sub:
|
||||
if not self.transcripts:
|
||||
transcript_language = 'en'
|
||||
elif self.transcripts:
|
||||
transcript_language = self.transcripts.keys()[0]
|
||||
languages = {'en': 'English'}
|
||||
else:
|
||||
# this for the case, when for currently selected video,
|
||||
# there are no translations and English subtitles are not set by instructor.
|
||||
transcript_language = 'null'
|
||||
if self.transcript_language in self.transcripts:
|
||||
transcript_language = self.transcript_language
|
||||
else:
|
||||
transcript_language = self.transcripts.keys()[0]
|
||||
|
||||
all_languages = {i[0]: i[1] for i in settings.ALL_LANGUAGES}
|
||||
languages = {lang: all_languages[lang] for lang in self.transcripts}
|
||||
if self.sub:
|
||||
languages.update({'en': 'English'})
|
||||
languages = {
|
||||
lang: display
|
||||
for lang, display in settings.ALL_LANGUAGES
|
||||
if lang in self.transcripts
|
||||
}
|
||||
|
||||
if self.sub:
|
||||
languages['en'] = 'English'
|
||||
|
||||
# OrderedDict for easy testing of rendered context in tests
|
||||
transcript_languages = OrderedDict(sorted(languages.items(), key=itemgetter(1)))
|
||||
|
||||
Reference in New Issue
Block a user