o
    lWi_                     @  s  d dl mZ d dlZddlmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZ ddlmZ ddlmZ ddlmZ ejrqddlmZm Z  ddl!m"Z"m#Z# ddl$m%Z%m&Z& e'ej(dZ)G dd dZ*G dd dZ+dS )    )annotationsN   )core)AsyncClientWrapperSyncClientWrapper)RequestOptions)DeleteDubbingResponseModel)DoDubbingResponse) DubbingMetadataPageResponseModel)DubbingMetadataResponse   )AsyncRawDubbingClientRawDubbingClient)DubbingCreateRequestMode)DubbingListRequestDubbingStatus)!DubbingListRequestFilterByCreator) DubbingListRequestOrderDirection)AsyncAudioClientAudioClient)AsyncResourceClientResourceClient)AsyncTranscriptClientTranscriptClient.c                   @     e Zd ZdGddZedHddZd	d	d	d	d	d	d	d
dIddZeeeeeeeeeeeeeeeeeeeed	ddJd6d7Zd	d8dKd<d=Z	d	d8dLd?d@Z
edAdB ZedCdD ZedEdF Zd	S )MDubbingClientclient_wrapperr   c                C  (   t |d| _|| _d | _d | _d | _d S Nr   )r   _raw_client_client_wrapper	_resource_audio_transcriptselfr    r&   ]/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/dubbing/client.py__init__   
   
zDubbingClient.__init__returnr   c                 C     | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawDubbingClient
        r   r%   r&   r&   r'   with_raw_response$      	zDubbingClient.with_raw_responseNcursor	page_sizedubbing_statusfilter_by_creatororder_byorder_directionrequest_optionsr1   typing.Optional[str]r2   typing.Optional[int]r3   0typing.Optional[DubbingListRequestDubbingStatus]r4   2typing.Optional[DubbingListRequestFilterByCreator]r5   -typing.Optional[typing.Literal['created_at']]r6   1typing.Optional[DubbingListRequestOrderDirection]r7   typing.Optional[RequestOptions]r
   c          	   	   C  s    | j j|||||||d}|jS )a
  
        List the dubs you have access to.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        page_size : typing.Optional[int]
            How many dubs to return at maximum. Can not exceed 200, defaults to 100.

        dubbing_status : typing.Optional[DubbingListRequestDubbingStatus]
            What state the dub is currently in.

        filter_by_creator : typing.Optional[DubbingListRequestFilterByCreator]
            Filters who created the resources being listed, whether it was the user running the request or someone else that shared the resource with them.

        order_by : typing.Optional[typing.Literal["created_at"]]
            The field to use for ordering results from this query.

        order_direction : typing.Optional[DubbingListRequestOrderDirection]
            The order direction to use for results from this query.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DubbingMetadataPageResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.list(
            cursor="cursor",
            page_size=1,
            dubbing_status="dubbing",
            filter_by_creator="personal",
            order_direction="DESCENDING",
        )
        r0   r   listdata	r%   r1   r2   r3   r4   r5   r6   r7   	_responser&   r&   r'   r@   /   s   9	zDubbingClient.listfilecsv_fileforeground_audio_filebackground_audio_filename
source_urlsource_langtarget_langtarget_accentnum_speakers	watermark
start_timeend_timehighest_resolutiondrop_background_audiouse_profanity_filterdubbing_studiodisable_voice_cloningmodecsv_fpsr7   rE   typing.Optional[core.File]rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   typing.Optional[bool]rP   rQ   rR   rS   rT   rU   rV   rW   )typing.Optional[DubbingCreateRequestMode]rX   typing.Optional[float]r	   c                C  s   | j jdi d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|d|d|d|d|}|jS )a  
        Dubs a provided audio or video file into given language.

        Parameters
        ----------
        file : typing.Optional[core.File]
            See core.File for more documentation

        csv_file : typing.Optional[core.File]
            See core.File for more documentation

        foreground_audio_file : typing.Optional[core.File]
            See core.File for more documentation

        background_audio_file : typing.Optional[core.File]
            See core.File for more documentation

        name : typing.Optional[str]
            Name of the dubbing project.

        source_url : typing.Optional[str]
            URL of the source video/audio file.

        source_lang : typing.Optional[str]
            Source language. Expects a valid iso639-1 or iso639-3 language code.

        target_lang : typing.Optional[str]
            The Target language to dub the content into. Expects a valid iso639-1 or iso639-3 language code.

        target_accent : typing.Optional[str]
            [Experimental] An accent to apply when selecting voices from the library and to use to inform translation of the dialect to prefer.

        num_speakers : typing.Optional[int]
            Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers

        watermark : typing.Optional[bool]
            Whether to apply watermark to the output video.

        start_time : typing.Optional[int]
            Start time of the source video/audio file.

        end_time : typing.Optional[int]
            End time of the source video/audio file.

        highest_resolution : typing.Optional[bool]
            Whether to use the highest resolution available.

        drop_background_audio : typing.Optional[bool]
            An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues.

        use_profanity_filter : typing.Optional[bool]
            [BETA] Whether transcripts should have profanities censored with the words '[censored]'

        dubbing_studio : typing.Optional[bool]
            Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource.

        disable_voice_cloning : typing.Optional[bool]
            Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. Voices used from the library will contribute towards a workspace's custom voices limit, and if there aren't enough available slots the dub will fail. Using this feature requires the caller to have the 'add_voice_from_voice_library' permission on their workspace to access new voices.

        mode : typing.Optional[DubbingCreateRequestMode]
            The mode in which to run this Dubbing job. Defaults to automatic, use manual if specifically providing a CSV transcript to use.

        csv_fps : typing.Optional[float]
            Frames per second to use when parsing a CSV file for dubbing. If not provided, FPS will be inferred from timecodes.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DoDubbingResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.create()
        rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r7   Nr&   r   createrA   r%   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r7   rC   r&   r&   r'   r^   s   sX   k	
zDubbingClient.creater7   
dubbing_idstrr   c                C     | j j||d}|jS )a~  
        Returns metadata about a dubbing project, including whether it's still in progress or not

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DubbingMetadataResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.get(
            dubbing_id="dubbing_id",
        )
        r`   r   getrA   r%   ra   r7   rC   r&   r&   r'   re         zDubbingClient.getr   c                C  rc   )aE  
        Deletes a dubbing project.

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteDubbingResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.delete(
            dubbing_id="dubbing_id",
        )
        r`   r   deleterA   rf   r&   r&   r'   ri     rg   zDubbingClient.deletec                 C  *   | j d u rddlm} || jd| _ | j S )Nr   )r   r   )r!   resource.clientr   r    )r%   r   r&   r&   r'   resource9     
zDubbingClient.resourcec                 C  rj   )Nr   )r   r   )r"   audio.clientr   r    )r%   r   r&   r&   r'   audioA  rm   zDubbingClient.audioc                 C  rj   )Nr   )r   r   )r#   transcript.clientr   r    )r%   r   r&   r&   r'   
transcriptI  rm   zDubbingClient.transcript)r   r   )r*   r   r1   r8   r2   r9   r3   r:   r4   r;   r5   r<   r6   r=   r7   r>   r*   r
   ,rE   rY   rF   rY   rG   rY   rH   rY   rI   r8   rJ   r8   rK   r8   rL   r8   rM   r8   rN   r9   rO   rZ   rP   r9   rQ   r9   rR   rZ   rS   rZ   rT   rZ   rU   rZ   rV   rZ   rW   r[   rX   r\   r7   r>   r*   r	   ra   rb   r7   r>   r*   r   ra   rb   r7   r>   r*   r   __name__
__module____qualname__r(   propertyr.   r@   OMITr^   re   ri   rl   ro   rq   r&   r&   r&   r'   r      sZ    
G "!

r   c                   @  r   )MAsyncDubbingClientr   r   c                C  r   r   )r   r   r    r!   r"   r#   r$   r&   r&   r'   r(   S  r)   zAsyncDubbingClient.__init__r*   r   c                 C  r+   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawDubbingClient
        r,   r-   r&   r&   r'   r.   Z  r/   z$AsyncDubbingClient.with_raw_responseNr0   r1   r8   r2   r9   r3   r:   r4   r;   r5   r<   r6   r=   r7   r>   r
   c          	   	     s(   | j j|||||||dI dH }|jS )a  
        List the dubs you have access to.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        page_size : typing.Optional[int]
            How many dubs to return at maximum. Can not exceed 200, defaults to 100.

        dubbing_status : typing.Optional[DubbingListRequestDubbingStatus]
            What state the dub is currently in.

        filter_by_creator : typing.Optional[DubbingListRequestFilterByCreator]
            Filters who created the resources being listed, whether it was the user running the request or someone else that shared the resource with them.

        order_by : typing.Optional[typing.Literal["created_at"]]
            The field to use for ordering results from this query.

        order_direction : typing.Optional[DubbingListRequestOrderDirection]
            The order direction to use for results from this query.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DubbingMetadataPageResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.list(
                cursor="cursor",
                page_size=1,
                dubbing_status="dubbing",
                filter_by_creator="personal",
                order_direction="DESCENDING",
            )


        asyncio.run(main())
        r0   Nr?   rB   r&   r&   r'   r@   e  s   A	zAsyncDubbingClient.listrD   rE   rY   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rZ   rP   rQ   rR   rS   rT   rU   rV   rW   r[   rX   r\   r	   c                  s   | j jdi d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|d|d|d|d|I dH }|jS )a  
        Dubs a provided audio or video file into given language.

        Parameters
        ----------
        file : typing.Optional[core.File]
            See core.File for more documentation

        csv_file : typing.Optional[core.File]
            See core.File for more documentation

        foreground_audio_file : typing.Optional[core.File]
            See core.File for more documentation

        background_audio_file : typing.Optional[core.File]
            See core.File for more documentation

        name : typing.Optional[str]
            Name of the dubbing project.

        source_url : typing.Optional[str]
            URL of the source video/audio file.

        source_lang : typing.Optional[str]
            Source language. Expects a valid iso639-1 or iso639-3 language code.

        target_lang : typing.Optional[str]
            The Target language to dub the content into. Expects a valid iso639-1 or iso639-3 language code.

        target_accent : typing.Optional[str]
            [Experimental] An accent to apply when selecting voices from the library and to use to inform translation of the dialect to prefer.

        num_speakers : typing.Optional[int]
            Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers

        watermark : typing.Optional[bool]
            Whether to apply watermark to the output video.

        start_time : typing.Optional[int]
            Start time of the source video/audio file.

        end_time : typing.Optional[int]
            End time of the source video/audio file.

        highest_resolution : typing.Optional[bool]
            Whether to use the highest resolution available.

        drop_background_audio : typing.Optional[bool]
            An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues.

        use_profanity_filter : typing.Optional[bool]
            [BETA] Whether transcripts should have profanities censored with the words '[censored]'

        dubbing_studio : typing.Optional[bool]
            Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource.

        disable_voice_cloning : typing.Optional[bool]
            Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. Voices used from the library will contribute towards a workspace's custom voices limit, and if there aren't enough available slots the dub will fail. Using this feature requires the caller to have the 'add_voice_from_voice_library' permission on their workspace to access new voices.

        mode : typing.Optional[DubbingCreateRequestMode]
            The mode in which to run this Dubbing job. Defaults to automatic, use manual if specifically providing a CSV transcript to use.

        csv_fps : typing.Optional[float]
            Frames per second to use when parsing a CSV file for dubbing. If not provided, FPS will be inferred from timecodes.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DoDubbingResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.create()


        asyncio.run(main())
        rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r7   Nr&   r]   r_   r&   r&   r'   r^     sZ   s	

zAsyncDubbingClient.creater`   ra   rb   r   c                     | j j||dI dH }|jS )a  
        Returns metadata about a dubbing project, including whether it's still in progress or not

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DubbingMetadataResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.get(
                dubbing_id="dubbing_id",
            )


        asyncio.run(main())
        r`   Nrd   rf   r&   r&   r'   re   =     &zAsyncDubbingClient.getr   c                  r}   )a  
        Deletes a dubbing project.

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteDubbingResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.delete(
                dubbing_id="dubbing_id",
            )


        asyncio.run(main())
        r`   Nrh   rf   r&   r&   r'   ri   f  r~   zAsyncDubbingClient.deletec                 C  rj   )Nr   )r   r   )r!   rk   r   r    )r%   r   r&   r&   r'   rl     rm   zAsyncDubbingClient.resourcec                 C  rj   )Nr   )r   r   )r"   rn   r   r    )r%   r   r&   r&   r'   ro     rm   zAsyncDubbingClient.audioc                 C  rj   )Nr   )r   r   )r#   rp   r   r    )r%   r   r&   r&   r'   rq     rm   zAsyncDubbingClient.transcript)r   r   )r*   r   rr   rs   rt   ru   rv   r&   r&   r&   r'   r|   R  sZ    
O *)

r|   ),
__future__r   typing r   core.client_wrapperr   r   core.request_optionsr   #types.delete_dubbing_response_modelr   types.do_dubbing_responser	   *types.dubbing_metadata_page_response_modelr
   types.dubbing_metadata_responser   
raw_clientr   r   !types.dubbing_create_request_moder   )types.dubbing_list_request_dubbing_statusr   ,types.dubbing_list_request_filter_by_creatorr   *types.dubbing_list_request_order_directionr   TYPE_CHECKINGrn   r   r   rk   r   r   rp   r   r   castAnyr{   r   r|   r&   r&   r&   r'   <module>   s.     8