
    W|h                     d   S r SSKrSSKrSSKrSSKJr  \R                  S 5       r\R                  S 5       r\R                  S 5       r\R                  S 5       r	\R                  S 5       r
\R                  S	 5       r\R                  S
 5       rS rS rS r\R                  S 5       rS rg)zDecorators used by moviepy.    N)convert_to_secondsc                 >    UR                  5       nU " U/UQ70 UD6  U$ )zKApplies ``func(clip.copy(), *args, **kwargs)`` and returns ``clip.copy()``.)copyfuncclipargskwargsnew_clips        L/home/james-whalen/.local/lib/python3.13/site-packages/moviepy/decorators.pyoutplacer      s&     yy{H#D#F#O    c                 \    UR                   (       a  UR                  5       nU " U/UQ70 UD6$ )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+     ||{{}&t&v&&r   c                 x    U " U/UQ70 UD6n[        USS5      (       a  U " UR                  /UQ70 UD6Ul        U$ )zRApplies the same function ``func`` to the mask of the clip created with
``func``.
maskN)getattrr   r   s        r   apply_to_maskr      sF    
 D*4*6*Hx&&X]]<T<V<Or   c                 x    U " U/UQ70 UD6n[        USS5      (       a  U " UR                  /UQ70 UD6Ul        U$ )zMApplies the function ``func`` to the audio of the clip created with ``func``.audioN)r   r   r   s        r   apply_to_audior   &   sF     D*4*6*Hx$''hnn>t>v>Or   c                 J    UR                   c  [        S5      eU " U/UQ70 UD6$ )z,Raises an error if the clip has no duration.zAttribute 'duration' not set)duration
ValueErrorr   s       r   requires_durationr   /   s/     }}788D*4*6**r   c                 l    [        US5      (       a  UR                  c  [        S5      eU " U/UQ70 UD6$ )z'Raises an error if the clip has no fps.fpszAttribute 'fps' not set)hasattrr    r   r   s       r   requires_fpsr"   8   s;     4488#3233D*4*6**r   c                     [        US5      (       a*  UR                  b  U " XR                  /UQ70 UD6Ul        U$ U " X/UQ70 UD6$ )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   sO     tW::!fjjB4B6BDJF242622r   c                    ^ ^ U U4S jnU$ )zPApplies preprocess_func to variables in varnames before launching
the function.
c                    >^ [         R                  " U 5      R                  mUUU4S jn[        R                  " X5      $ )Nc                    > [        UT	5       VVs/ s H  u  p4UT;   a  Ub  T
" U5      OUPM     nnnUR                  5        VVs0 s H  u  pgXfT;   a  T
" U5      OU_M     nnnU " U0 UD6$ s  snnf s  snnf )Nzipitems)r   r	   r
   argnamenew_argskwargvalue
new_kwargsargnamespreprocess_funcvarnamess            r   wrapper/preprocess_args.<locals>.decor.<locals>.wrapperY   s     $'tX#6 $7KS (s $C( $7   '-lln&4NU (1Bu-M&4   0Z00s   A-A3inspectgetfullargspecr	   	decoratordecorate)r   r5   r2   r3   r4   s     @r   decorpreprocess_args.<locals>.decorV   s1    ))$/44	1 !!$00r    )r3   r4   r<   s   `` r   preprocess_argsr?   Q   s    
1( Lr   c                 "    [        [        U 5      $ )z,Converts the specified variables to seconds.)r?   r   r4   s    r   convert_parameter_to_secondsrB   m   s    -x88r   c                 6    [        [        R                  U 5      $ )z2Converts the specified variables to a path string.)r?   osfspathrA   s    r   convert_path_to_stringrF   r   s    299h//r   c                 T    UR                   c  UR                  5       nU " U/UQ70 UD6$ )z(Add a mask to the clip if there is none.)r   	with_maskr   s       r   add_mask_if_nonerI   w   s/     yy~~&t&v&&r   c                    ^ ^^ [         R                  " T 5      R                  SS mU 4S jmUU4S jn[        R                  " T U5      $ )zBWill use ``clip.fps`` if no ``fps=...`` is provided in **kwargs**.   Nc                 z   > Ub  U$ [        U SS 5      (       a  U R                  $ [        STR                  -  5      e)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_fps)use_clip_fps_by_default.<locals>.find_fps   sF    ?JT5$''88O1 48==A
 	
r   c           	         > [        UT
5       VVs/ s H  u  pEUS:X  a  T" X5      OUPM     nnnUR                  5        VVs0 s H  u  pxXwS:X  a  T" X5      OU_M     n	nnU " U/UQ70 U	D6$ s  snnf s  snnf )Nr    r)   )r   r   r	   r
   r,   r-   r.   r/   r0   r1   r2   rO   s             r   r5   (use_clip_fps_by_default.<locals>.wrapper   s      #42
2 $(5=HTc92 	 
 #),,.
"0 UN8D(E"0 	 

 D282z22

s   A.A4r7   )r   r5   r2   rO   s   ` @@r   use_clip_fps_by_defaultrS      s?    %%d+004H


3 dG,,r   )__doc__r8   rD   r:   moviepy.toolsr   r   r   r   r   r   r"   r%   r?   rB   rF   rI   rS   r>   r   r   <module>rV      s    !  	  ,   ' '     + + + + 3 389
0
 ' '-r   