@login_required
def choose_transcripts(request):
 response = {'status': 'Error', 'subs': ''}
 try:
  (data, videos, item) = _validate_transcripts_data(request)
 except TranscriptsRequestValidationException as e:
  return error_response(response, e.message)
 html5_id = data.get('html5_id')
 html5_id_to_remove = [x for x in videos['html5'] if (x != html5_id)]
 if html5_id_to_remove:
  remove_subs_from_store(html5_id_to_remove, item)
 if (item.sub != html5_id):
  item.sub = html5_id
  item.save_with_metadata(request.user)
 response = {'status': 'Success', 'subs': item.sub}
 return JsonResponse(response)

@ login_required def choose_transcripts ( request ) : response = { 'status' : 'Error' , 'subs' : '' } try : ( data , videos , item ) = _validate_transcripts_data ( request ) except TranscriptsRequestValidationException as e : return error_response ( response , e . message ) html5_id = data . get ( 'html5_id' ) html5_id_to_remove = [ x for x in videos [ 'html5' ] if ( x != html5_id ) ] if html5_id_to_remove : remove_subs_from_store ( html5_id_to_remove , item ) if ( item . sub != html5_id ) : item . sub = html5_id item . save_with_metadata ( request . user ) response = { 'status' : 'Success' , 'subs' : item . sub } return JsonResponse ( response )
replaces html5 subtitles .