refactor: Move available_translations into VideoConfigService (#37808)
This moves edx-platform-specific logic out of the VideoBlock, in preparation for the VideoBlock extraction: openedx#36282
This commit is contained in:
committed by
GitHub
parent
e26a3fb7e6
commit
360a97fdd3
@@ -1204,7 +1204,14 @@ class _BuiltInVideoBlock(
|
||||
"file_size": 0, # File size is not relevant for external link
|
||||
}
|
||||
|
||||
available_translations = self.available_translations(self.get_transcripts_info())
|
||||
video_config_service = self.runtime.service(self, 'video_config')
|
||||
if video_config_service:
|
||||
available_translations = video_config_service.available_translations(
|
||||
self,
|
||||
self.get_transcripts_info()
|
||||
)
|
||||
else:
|
||||
available_translations = []
|
||||
transcripts = {
|
||||
lang: self.runtime.handler_url(self, 'transcript', 'download', query="lang=" + lang, thirdparty=True)
|
||||
for lang in available_translations
|
||||
|
||||
@@ -322,7 +322,11 @@ class VideoStudentViewHandlers:
|
||||
mimetype
|
||||
)
|
||||
elif dispatch.startswith('available_translations'):
|
||||
available_translations = self.available_translations(
|
||||
video_config_service = self.runtime.service(self, 'video_config')
|
||||
if not video_config_service:
|
||||
return Response(status=404)
|
||||
available_translations = video_config_service.available_translations(
|
||||
self,
|
||||
transcripts,
|
||||
verify_assets=True,
|
||||
is_bumper=is_bumper
|
||||
@@ -395,7 +399,14 @@ class VideoStudioViewHandlers:
|
||||
|
||||
# Get available transcript languages.
|
||||
transcripts = self.get_transcripts_info()
|
||||
available_translations = self.available_translations(transcripts, verify_assets=True)
|
||||
video_config_service = self.runtime.service(self, 'video_config')
|
||||
if not video_config_service:
|
||||
return error
|
||||
available_translations = video_config_service.available_translations(
|
||||
self,
|
||||
transcripts,
|
||||
verify_assets=True
|
||||
)
|
||||
|
||||
if missing:
|
||||
error = _('The following parameters are required: {missing}.').format(missing=', '.join(missing))
|
||||
|
||||
Reference in New Issue
Block a user