Ë
    Eü´jŸ  ã                   óR   — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	  G d„ de	«      Z
y)	z�Contains different functions to make end and opening credits, even though it is
difficult to fill everyone needs in this matter.
é    )Úconvert_path_to_string)ÚCompositeVideoClip)ÚResize)Ú	ImageClipÚTextClipc                   óH   ‡ — e Zd ZdZ ed«      	 	 	 	 	 	 	 dˆ fd„	«       Zˆ xZS )ÚCreditsClipaí  Credits clip.

    Parameters
    ----------

    creditfile
      A string or path like object pointing to a text file
      whose content must be as follows:

      ..code:: python

          # This is a comment
          # The next line says : leave 4 blank lines
          .blank 4

          ..Executive Story Editor
          MARCEL DURAND

          ..Associate Producers
          MARTIN MARCEL
          DIDIER MARTIN

          ..Music Supervisor
          JEAN DIDIER

    width
      Total width of the credits text in pixels

    gap
      Horizontal gap in pixels between the jobs and the names

    color
      Color of the text. See ``TextClip.list('color')``
      for a list of acceptable names.

    font
      Name of the font to use. See ``TextClip.list('font')`` for
      the list of fonts you can use on your computer.

    font_size
      Size of font to use

    stroke_color
      Color of the stroke (=contour line) of the text. If ``None``,
      there will be no stroke.

    stroke_width
      Width of the stroke, in pixels. Can be a float, like 1.5.

    bg_color
      Color of the background. If ``None``, the background will be transparent.

    Returns
    -------

    image
      An ImageClip instance that looks like this and can be scrolled
      to make some credits: ::

          Executive Story Editor    MARCEL DURAND
             Associate Producers    MARTIN MARCEL
                                    DIDIER MARTIN
                Music Supervisor    JEAN DIDIER

    Ú
creditfilec
                 óÔ  •— g }
d}t        |«      5 }|D ]¹  }|j                  d«      rŒ|j                  d«      r?t        t        |j	                  d«      d   «      «      D ]  }|
j                  ddg«       Œ Œe|j                  d«      r|
j                  |dd  d	g«       d}Œ�|r|
j                  d	|g«       d
}Œ§|
j                  d|g«       Œ» 	 d d d «       d„ t        |
Ž D «       \  }}|df|dffD ��cg c]  \  }}t        |||||||¬«      ‘Œ c}}\  }}t        ||j                  |j                  |	z   df«      g|j                  |j                  z   |	z   |j                  f|¬«      }|j                  t        |¬«      g«      }t        t        | �?  |j!                  d«      «       t#        |j$                  j!                  d«      d¬«      | _        y # 1 sw Y   �ŒxY wc c}}w )NT)ú
ú#z.blankú é   r   z..é   Ú Fc              3   ó>   K  — | ]  }d j                  |«      –— Œ y­w)r   N)Újoin)Ú.0Úlines     úY/root/workspace/ytshorts/venv/lib/python3.12/site-packages/moviepy/video/tools/credits.pyú	<genexpr>z'CreditsClip.__init__.<locals>.<genexpr>q   s   è ø€ Ò=¨�r—w‘w˜t—}Ñ=ùs   ‚ÚleftÚright)ÚtextÚcolorÚstroke_colorÚstroke_widthÚfontÚ	font_sizeÚ
text_alignr   )ÚsizeÚbg_color)Úwidth)Úis_mask)ÚopenÚ
startswithÚrangeÚintÚsplitÚappendÚzipr   r   Úwith_positionÚwÚhÚwith_effectsr   ÚsuperÚ__init__Ú	get_framer   Úmask)Úselfr
   r#   r   r   r   r   r   r"   ÚgapÚtextsÚone_lineÚfiler   Úir   r   ÚtxtÚalignÚboth_columnsÚscaledÚ	__class__s                        €r   r1   zCreditsClip.__init__N   sâ  ø€ ð ˆØˆä�*Óð 	/ Øò /�Ø—?‘? ;Ô/àØ—_‘_ XÔ.ä"¤3 t§z¡z°#£°qÑ'9Ó#:Ó;ò 3˜ØŸ™ d¨D \Õ2ñ3à—_‘_ TÔ*Ø—L‘L $ q r (¨B Ô0Ø#‘HÙØ—L‘L " d Ô,Ø$‘Hà—L‘L $¨ Õ.ñ/÷	/ñ$ >´°e°Ô=‰ˆˆeð !% f˜~°°wÐ/?Ð@÷
ñ ��Uô ØØØ)Ø)ØØ#Ø öó
‰ˆˆeô *Ø�5×&Ñ&¨¯©°©°aÐ'8Ó9Ð:Ø—&‘&˜5Ÿ7™7Ñ" SÑ(¨%¯'©'Ð2Øô
ˆð ×*Ñ*¬F¸Ô,?Ð+@ÓAˆô
 	Œh˜Ñ& v×'7Ñ'7¸Ó':Ô;Ü˜fŸk™k×3Ñ3°AÓ6ÀÔEˆ�	÷_	/ñ 	/üó*
s   ‘B?GÃ6G$ÇG!)ÚwhiteÚblackr   zImpact-Normalé<   Nr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r1   Ú__classcell__)r>   s   @r   r	   r	      s<   ø„ ñ@ñD ˜LÓ)ð
 ØØØØØØô?Fó *ô?Fó    r	   N)rE   Úmoviepy.decoratorsr   Ú,moviepy.video.compositing.CompositeVideoClipr   Úmoviepy.video.fx.Resizer   Úmoviepy.video.VideoClipr   r   r	   © rG   r   ú<module>rM      s(   ðñõ 6Ý KÝ *ß 7ôCF�(õ CFrG   