
    -i                     F   d Z ddlZddlZddlZddlmZ ej        d             Zej        d             Zej        d             Zej        d             Z	ej        d             Z
ej        d	             Zej        d
             Zd Zd Zd Zej        d             Zd ZdS )zDecorators used by moviepy.    N)convert_to_secondsc                 F    |                                 } | |g|R i | |S )zKApplies ``func(clip.copy(), *args, **kwargs)`` and returns ``clip.copy()``.)copyfuncclipargskwargsnew_clips        P/var/www/html/speakWrite/venv/lib/python3.11/site-packages/moviepy/decorators.pyoutplacer      s6     yy{{HD#D###F###O    c                 P    |j         r|                                } | |g|R i |S )zEIf the clip is a mask, convert it to RGB before running the function.)is_maskto_RGBr   r   r	   r
   s       r   convert_masks_to_RGBr      s;     | {{}}4&t&&&v&&&r   c                 l     | |g|R i |}t          |dd          r | |j        g|R i ||_        |S )zZApplies the same function ``func`` to the mask of the clip created with
    ``func``.
    maskN)getattrr   r   s        r   apply_to_maskr      s_    
 tD*4***6**Hx&& =X]<T<<<V<<Or   c                 l     | |g|R i |}t          |dd          r | |j        g|R i ||_        |S )zMApplies the function ``func`` to the audio of the clip created with ``func``.audioN)r   r   r   s        r   apply_to_audior   &   s_     tD*4***6**Hx$'' ?hn>t>>>v>>Or   c                 F    |j         t          d           | |g|R i |S )z,Raises an error if the clip has no duration.NzAttribute 'duration' not set)duration
ValueErrorr   s       r   requires_durationr   /   s;     }7888tD*4***6***r   c                 f    t          |d          r|j        t          d           | |g|R i |S )z'Raises an error if the clip has no fps.fpsNzAttribute 'fps' not set)hasattrr    r   r   s       r   requires_fpsr"   8   sL     4 +48#32333tD*4***6***r   c                 |    t          |d          r |j         | ||j        g|R i ||_        |S  | ||g|R i |S )zUse an audio function on a video/audio clip.

    This decorator tells that the function func (audioclip -> audioclip)
    can be also used on a video clip, at which case it returns a
    videoclip with unmodified video and modified audio.
    r   )r!   r   )r   effectr   r	   r
   s        r   audio_video_effectr%   A   sj     tW 3:!fdjB4BBB6BBDJtFD242226222r   c                       fd}|S )zXApplies preprocess_func to variables in varnames before launching
    the function.
    c                 p    t          j        |           j        fd}t          j        | |          S )Nc                     fdt          |          D             }fd|                                D             } | |i |S )Nc                 <    g | ]\  }}|v r| |          n|S )N ).0argnamepreprocess_funcvarnamess      r   
<listcomp>zCpreprocess_args.<locals>.decor.<locals>.wrapper.<locals>.<listcomp>Z   sP         S$ ((s $OC(((	  r   c                 :    i | ]\  }}||v r |          n|S r*   r*   )r+   kwargvaluer.   r/   s      r   
<dictcomp>zCpreprocess_args.<locals>.decor.<locals>.wrapper.<locals>.<dictcomp>b   sH       "UE (1B1Bu---  r   zipitems)r   r	   r
   new_args
new_kwargsargnamesr.   r/   s        r   wrapperz/preprocess_args.<locals>.decor.<locals>.wrapperY   s         $'tX#6#6  H    &,llnn  J 40Z000r   inspectgetfullargspecr	   	decoratordecorate)r   r;   r:   r.   r/   s     @r   decorzpreprocess_args.<locals>.decorV   sO    )$//4	1 	1 	1 	1 	1 	1 	1 !$000r   r*   )r.   r/   rA   s   `` r   preprocess_argsrB   Q   s)    
1 1 1 1 1 1( Lr   c                 ,    t          t          |           S )z,Converts the specified variables to seconds.)rB   r   r/   s    r   convert_parameter_to_secondsrE   m   s    -x888r   c                 6    t          t          j        |           S )z2Converts the specified variables to a path string.)rB   osfspathrD   s    r   convert_path_to_stringrI   r   s    29h///r   c                 P    |j         |                                } | |g|R i |S )z(Add a mask to the clip if there is none.)r   	with_maskr   s       r   add_mask_if_nonerL   w   s;     y~~4&t&&&v&&&r   c                      t          j                   j        dd          fdfd}t          j         |          S )zBWill use ``clip.fps`` if no ``fps=...`` is provided in **kwargs**.   Nc                 j    ||S t          | dd           r| j        S t          dj        z            )Nr    zNo 'fps' (frames per second) attribute specified for function %s and the clip has no 'fps' attribute. Either provide e.g. fps=24 in the arguments of the function, or define the clip's fps with `clip.fps=24`)r   r    AttributeError__name__)r   r    r   s     r   find_fpsz)use_clip_fps_by_default.<locals>.find_fps   sL    ?JT5$'' 	8O1 48=A
 
 	
r   c                     fdt          |          D             }fd|                                D             } | g|R i |S )Nc                 >    g | ]\  }}|d k    r |          n|S r    r*   )r+   r,   r-   r   rR   s      r   r0   z<use_clip_fps_by_default.<locals>.wrapper.<locals>.<listcomp>   sF     
 
 
d $(5==HHT3c
 
 
r   c                 @    i | ]\  }}||d k    r |          n|S rU   r*   )r+   r2   r3   r   rR   s      r   r4   z<use_clip_fps_by_default.<locals>.wrapper.<locals>.<dictcomp>   sH     
 
 
 EUNN88D%(((
 
 
r   r5   )r   r   r	   r
   r8   r9   r:   rR   s    `    r   r;   z(use_clip_fps_by_default.<locals>.wrapper   s    
 
 
 
 
"422
 
 

 
 
 
 
"(,,..
 
 


 tD28222z222r   r<   )r   r;   r:   rR   s   ` @@r   use_clip_fps_by_defaultrW      sm    %d++04H

 

 

 

 


3 
3 
3 
3 
3 
3 dG,,,r   )__doc__r=   rG   r?   moviepy.toolsr   r   r   r   r   r   r"   r%   rB   rE   rI   rL   rW   r*   r   r   <module>rZ      sy   ! !  				     , , , , , ,    ' ' '       + + + + + + 3 3 3  89 9 9
0 0 0
 ' ' '- - - - -r   