Skip to content

Commit

Permalink
Merge pull request #34479 from DmytroAlipov/fix-transcript-replacement
Browse files Browse the repository at this point in the history
fix: an issue where changing the transcript language code
  • Loading branch information
feanil authored Dec 3, 2024
2 parents 7ac03a2 + 911bf73 commit 0baf71c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xmodule/video_block/video_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def validate_transcript_upload_data(self, data):

return error

# pylint: disable=too-many-statements
@XBlock.handler
def studio_transcript(self, request, dispatch):
"""
Expand Down Expand Up @@ -534,6 +535,10 @@ def studio_transcript(self, request, dispatch):
'edx_video_id': edx_video_id,
'language_code': new_language_code
}
# If a new transcript is added, then both new_language_code and
# language_code fields will have the same value.
if language_code != new_language_code:
self.transcripts.pop(language_code, None)
self.transcripts[new_language_code] = f'{edx_video_id}-{new_language_code}.srt'
response = Response(json.dumps(payload), status=201)
except (TranscriptsGenerationException, UnicodeDecodeError):
Expand Down

0 comments on commit 0baf71c

Please sign in to comment.