
    W|h                     R    S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	   " S S\	5      r
g)	zContains 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                   T   ^  \ rS rSrSr\" S5             SU 4S jj5       rSrU =r$ )CreditsClip   a9  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
                   > / n
Sn[        U5       nU H  nUR                  S5      (       a  M  UR                  S5      (       aB  [        [        UR	                  S5      S   5      5       H  nU
R                  SS/5        M     Ms  UR                  S5      (       a  U
R                  USS  S	/5        SnM  U(       a  U
R                  S	U/5        S
nM  U
R                  SU/5        M     S S S 5        S [        U
6  5       u  nnUS4US44 VVs/ s H  u  nn[        UUUUUUUS9PM     snnu  nn[        UUR                  UR                  U	-   S45      /UR                  UR                  -   U	-   UR                  4US9nUR                  [        US9/5      n[        [        U ]?  UR!                  S5      5        [#        UR$                  R!                  S5      SS9U l        g ! , (       d  f       GN= fs  snnf )NT)
#z.blank    r   z..    Fc              3   D   #    U  H  nS R                  U5      v   M     g7f)r   N)join).0lines     U/home/james-whalen/.local/lib/python3.13/site-packages/moviepy/video/tools/credits.py	<genexpr>'CreditsClip.__init__.<locals>.<genexpr>q   s     =rwwt}}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   r3   CreditsClip.__init__N   s    *??;//__X.."3tzz#q'9#:;dD\2 <__T**LL$qr(B0#HLL"d,$HLL$.  $ >e=e !%f~w/?@
 A
U ))#  A
e *5&&a'89:&&577"S(%''2
 **F,?+@A
 	h&v'7'7':;fkk33A6E	_ *
s   CG)G;)
G8)r5   )whiteblackr   zImpact-Normal<   Nr   )	__name__
__module____qualname____firstlineno____doc__r   r3   __static_attributes____classcell__)r@   s   @r   r	   r	      s<    @D L)
 ?F *?F    r	   N)rI   moviepy.decoratorsr   ,moviepy.video.compositing.CompositeVideoClipr   moviepy.video.fx.Resizer   moviepy.video.VideoClipr   r   r	    rL   r   <module>rR      s(    6 K * 7CF( CFrL   