@login_required
def save_transcripts(request):
 response = {'status': 'Error'}
 data = json.loads(request.GET.get('data', '{}'))
 if (not data):
  return error_response(response, 'Incoming video data is empty.')
 try:
  item = _get_item(request, data)
 except (InvalidKeyError, ItemNotFoundError):
  return error_response(response, "Can't find item by locator.")
 metadata = data.get('metadata')
 if (metadata is not None):
  new_sub = metadata.get('sub')
  for (metadata_key, value) in metadata.items():
   setattr(item, metadata_key, value)
  item.save_with_metadata(request.user)
  if new_sub:
   manage_video_subtitles_save(item, request.user)
  else:
   current_subs = data.get('current_subs')
   if (current_subs is not None):
    for sub in current_subs:
     remove_subs_from_store(sub, item)
  response['status'] = 'Success'
 return JsonResponse(response)

@ login_required def save_transcripts ( request ) : response = { 'status' : 'Error' } data = json . loads ( request . GET . get ( 'data' , '{}' ) ) if ( not data ) : return error_response ( response , 'Incoming video data is empty.' ) try : item = _get_item ( request , data ) except ( InvalidKeyError , ItemNotFoundError ) : return error_response ( response , "Can't find item by locator." ) metadata = data . get ( 'metadata' ) if ( metadata is not None ) : new_sub = metadata . get ( 'sub' ) for ( metadata_key , value ) in metadata . items ( ) : setattr ( item , metadata_key , value ) item . save_with_metadata ( request . user ) if new_sub : manage_video_subtitles_save ( item , request . user ) else : current_subs = data . get ( 'current_subs' ) if ( current_subs is not None ) : for sub in current_subs : remove_subs_from_store ( sub , item ) response [ 'status' ] = 'Success' return JsonResponse ( response )
saves video module with updated values of fields .