
    b6iNc                    j   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:                  r ddlmZm Z  ddl!m"Z"m#Z# ddl$m%Z%m&Z& ddl'm(Z(m)Z)  ejT                  ejV                  d      Z, G d d      Z- G d d      Z.y)    )annotationsN   )core)AsyncClientWrapperSyncClientWrapper)RequestOptions)DeleteDubbingResponseModel)DoDubbingResponse) DubbingMetadataPageResponseModel)DubbingMetadataResponse   )AsyncRawDubbingClientRawDubbingClient)DubbingCreateRequestMode)DubbingListRequestDubbingStatus)!DubbingListRequestFilterByCreator) DubbingListRequestOrderDirection)AsyncAudioClientAudioClient)AsyncResourceClientResourceClient)AsyncTranscriptClientTranscriptClient)AsyncTranscriptsClientTranscriptsClient.c                  Z   e Zd ZddZedd       Zdddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeeeeeeeeeeeeeeeeedd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZdd	 	 	 	 	 dd	Z	dd	 	 	 	 	 dd
Z
ed        Zed        Zed        Zed        Zy)DubbingClientc               l    t        |      | _        || _        d | _        d | _        d | _        d | _        y Nclient_wrapper)r   _raw_client_client_wrapper	_resource_audio_transcript_transcriptsselfr!   s     d/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/dubbing/client.py__init__zDubbingClient.__init__   s5    +>J-:>48>B@D    c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawDubbingClient
        r"   r)   s    r*   with_raw_responsezDubbingClient.with_raw_response&        r,   Ncursor	page_sizedubbing_statusfilter_by_creatororder_byorder_directionrequest_optionsc          	     ^    | j                   j                  |||||||      }|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",
        )
        r2   r"   listdata	r)   r3   r4   r5   r6   r7   r8   r9   	_responses	            r*   r<   zDubbingClient.list1   sA    r $$)))/++ * 
	 ~~r,   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_fpsr9   c               z    | j                   j                  |||||||||	|
|||||||||||      }|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. Note that manual mode is experimental and production use is strongly discouraged.

        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()
        r@   r"   creater=   r)   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   r9   r?   s                          r*   rW   zDubbingClient.createu   sk    V $$++"7"7!##'%!1"7!5)"7++ , 
	. ~~r,   r9   c               T    | j                   j                  ||      }|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",
        )
        rY   r"   getr=   r)   
dubbing_idr9   r?   s       r*   r\   zDubbingClient.get   s)    < $$((_(U	~~r,   c               T    | j                   j                  ||      }|j                  S )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",
        )
        rY   r"   deleter=   r]   s       r*   ra   zDubbingClient.delete  s)    < $$++J+X	~~r,   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r$   resource.clientr   r#   )r)   r   s     r*   resourcezDubbingClient.resource;  s+    >>!7+4;O;OPDN~~r,   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r%   audio.clientr   r#   )r)   r   s     r*   audiozDubbingClient.audioC  s+    ;;1%T5I5IJDK{{r,   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r&   transcript.clientr   r#   )r)   r   s     r*   
transcriptzDubbingClient.transcriptK  s0    #;/t?S?STDr,   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r'   transcripts.clientr   r#   )r)   r   s     r*   transcriptszDubbingClient.transcriptsS  s0    $= 1AUAU VD   r,   )r!   r   )returnr   r3   typing.Optional[str]r4   typing.Optional[int]r5   z0typing.Optional[DubbingListRequestDubbingStatus]r6   z2typing.Optional[DubbingListRequestFilterByCreator]r7   z-typing.Optional[typing.Literal['created_at']]r8   z1typing.Optional[DubbingListRequestOrderDirection]r9   typing.Optional[RequestOptions]rn   r   ,rA   typing.Optional[core.File]rB   rt   rC   rt   rD   rt   rE   rp   rF   rp   rG   rp   rH   rp   rI   rp   rJ   rq   rK   typing.Optional[bool]rL   rq   rM   rq   rN   ru   rO   ru   rP   ru   rQ   ru   rR   ru   rS   z)typing.Optional[DubbingCreateRequestMode]rT   ztyping.Optional[float]r9   rr   rn   r
   r^   strr9   rr   rn   r   r^   rw   r9   rr   rn   r	   __name__
__module____qualname__r+   propertyr0   r<   OMITrW   r\   ra   rd   rg   rj   rm    r,   r*   r   r      sj   E     (,*.KOPTBFMQ;?B %B (	B
 IB NB @B KB 9B 
*BN ,0/3<@<@%)+/,0,0.2-1+/+/)-487;6:047;:>*.;?/B )B -	B
  :B  :B #B )B *B *B ,B +B )B )B 'B  2!B"  5#B$ 4%B& .'B(  5)B* 8+B, (-B. 9/B0 
1BJ VZ3R	 D VZ3R	#B         ! !r,   r   c                  Z   e Zd ZddZedd       Zdddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeeeeeeeeeeeeeeeeedd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZdd	 	 	 	 	 dd	Z	dd	 	 	 	 	 dd
Z
ed        Zed        Zed        Zed        Zy)AsyncDubbingClientc               l    t        |      | _        || _        d | _        d | _        d | _        d | _        y r   )r   r"   r#   r$   r%   r&   r'   r(   s     r*   r+   zAsyncDubbingClient.__init__]  s5    0O-?C9=CGEIr,   c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawDubbingClient
        r.   r/   s    r*   r0   z$AsyncDubbingClient.with_raw_responsee  r1   r,   Nr2   c          	     z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)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())
        r2   Nr;   r>   s	            r*   r<   zAsyncDubbingClient.listp  sO     B **//)/++ 0 
 
	 ~~
s   &;9;r@   c                  K   | j                   j                  |||||||||	|
|||||||||||       d{   }|j                  S 7 w)aX  
        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. Note that manual mode is experimental and production use is strongly discouraged.

        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())
        r@   NrV   rX   s                          r*   rW   zAsyncDubbingClient.create  sy     f **11"7"7!##'%!1"7!5)"7++ 2 
 
	. ~~/
s   4A	AA	rY   c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)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())
        rY   Nr[   r]   s       r*   r\   zAsyncDubbingClient.getH  s7     L **..z?.[[	~~ \   !646c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)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())
        rY   Nr`   r]   s       r*   ra   zAsyncDubbingClient.deleteq  s7     L **11*o1^^	~~ _r   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r$   rc   r   r#   )r)   r   s     r*   rd   zAsyncDubbingClient.resource  s+    >>!<0@T@TUDN~~r,   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r%   rf   r   r#   )r)   r   s     r*   rg   zAsyncDubbingClient.audio  s+    ;;6*$:N:NODK{{r,   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r&   ri   r   r#   )r)   r   s     r*   rj   zAsyncDubbingClient.transcript  s0    #@4DDXDXYDr,   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r    )r'   rl   r   r#   )r)   r   s     r*   rm   zAsyncDubbingClient.transcripts  s0    $B 6dFZFZ [D   r,   )r!   r   )rn   r   ro   rs   rv   rx   ry   r   r,   r*   r   r   \  sj   J     (,*.KOPTBFMQ;?J %J (	J
 IJ NJ @J KJ 9J 
*J^ ,0/3<@<@%)+/,0,0.2-1+/+/)-487;6:047;:>*.;?/J )J -	J
  :J  :J #J )J *J *J ,J +J )J )J 'J  2!J"  5#J$ 4%J& .'J(  5)J* 8+J, (-J. 9/J0 
1JZ VZ''3R'	 'T VZ''3R'	#'R         ! !r,   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_CHECKINGrf   r   r   rc   r   r   ri   r   r   rl   r   r   castAnyr~   r   r   r   r,   r*   <module>r      su    #   G 1 L 9 Y E ? G V [ X	;DJMv{{6::s#|! |!~	\! \!r,   