2222from openedx .core .djangoapps .video_config .transcripts_utils import (
2323 Transcript ,
2424 clean_video_id ,
25- get_transcript_from_contentstore ,
2625 subs_filename ,
2726)
2827from xblocks_contrib .video .exceptions import (
@@ -38,6 +37,7 @@ def get_transcript(
3837 lang : str | None = None ,
3938 output_format : str = 'srt' ,
4039 youtube_id : str | None = None ,
40+ is_bumper : bool = False ,
4141) -> tuple [bytes , str , str ]:
4242 """
4343 Retrieve a transcript using a video block's configuration service.
@@ -51,7 +51,7 @@ def get_transcript(
5151 video_config_service = video_block .runtime .service (video_block , 'video_config' )
5252 if not video_config_service :
5353 raise Exception ("Video config service not found" )
54- return video_config_service .get_transcript (video_block , lang , output_format , youtube_id )
54+ return video_config_service .get_transcript (video_block , lang , output_format , youtube_id , is_bumper )
5555
5656
5757# Disable no-member warning:
@@ -276,29 +276,22 @@ def transcript(self, request, dispatch):
276276 self .transcript_language = language
277277
278278 try :
279- if is_bumper :
280- content , filename , mimetype = get_transcript_from_contentstore (
281- self ,
282- self .transcript_language ,
283- Transcript .SJSON ,
284- transcripts
285- )
286- else :
287- content , filename , mimetype = get_transcript (
288- self ,
289- lang = self .transcript_language ,
290- output_format = Transcript .SJSON ,
291- youtube_id = request .GET .get ('videoId' ),
292- )
293-
279+ youtube_id = None if is_bumper else request .GET .get ('videoId' )
280+ content , filename , mimetype = get_transcript (
281+ self ,
282+ lang = self .transcript_language ,
283+ output_format = Transcript .SJSON ,
284+ youtube_id = youtube_id ,
285+ is_bumper = is_bumper
286+ )
294287 response = self .make_transcript_http_response (
295288 content ,
296289 filename ,
297290 self .transcript_language ,
298291 mimetype ,
299292 add_attachment_header = False
300293 )
301- except ( NotFoundError , TranscriptNotFoundError ) as exc :
294+ except TranscriptNotFoundError as exc :
302295 edx_video_id = clean_video_id (self .edx_video_id )
303296 log .warning (
304297 '[Translation Dispatch] %s: %s' ,
0 commit comments