3
\                 @   sb   d dl mZmZ d dlZd dlmZ d dlZd dlmZ d dl	m
Z
 d dlmZ ejdd ZdS )	    )HttpResponseJsonResponseN)
S3Transfer)settings)SurveyReport)appc       
   
   C   s   dd l }|j }tjtjd}tjd	|}|jddt| tj	d t|  tj	d t| }|j
|}|j|}W d Q R X |j|}tjjt| d}	t||	_|	j  d S )
Nr   )aws_access_key_idaws_secret_access_keys3	us-east-1dls2018z
recording/zrecordings/)pk)r
   r   )Zspeech_recognitionZ
Recognizerr   AWS_ACCESS_KEYAWS_SECRET_KEYboto3clientdownload_filestr
MEDIA_ROOTZ	AudioFilerecordZrecognize_googler   objectsgetintvessel_descriptionsave)
survey_report_idoriginal_namesrrcredentialsr   audiosourcer   Zsurvey_update r"   :/var/www/html/dls.localhost.com/myproject/dls_api/tasks.pytext_to_speech	   s    
$

r$   )django.httpr   r   r   boto3.s3.transferr   requestsdjango.confr   
dls.modelsr   Zmyproject.celeryr   taskr$   r"   r"   r"   r#   <module>   s   