Ë
    £| k
  ã                  ór   — d Z ddlmZ dZdZdZdZdd„Zdd„Zdd	„Z	dd
„Z
dd„Zdd„Zdd„Zefdd„Zddd„Zy)zã/autopost: the posts of a whole series - "Episodes 01 to 20", "Episodes 21 to 40", ... - each with a download button.

The ranges are planned here (pure functions, easy to test); the handler in handlers/autopost.py sends them.
é    )Úannotationszhttps://t.me/EnglishéÈ   i † zïUsage: <code>/autopost &lt;total episodes&gt; &lt;interval&gt;</code>
Example: <code>/autopost 114 20</code> posts Episodes 01 to 20, 21 to 40 ... up to 114, each with a download button, and then asks you for the real link of every button.c                óB  — | xs dj                  dd«      j                  «       }t        |«      dk7  st        d„ |D «       «      st	        d«      ‚t        |d   «      t        |d   «      }}|dk  s|dk  rt	        d	«      ‚|t        kD  rt	        d
t        › d�«      ‚||fS )zQ'114 20' -> (114, 20). ValueError (with a message to show) when it can't be used.Ú Ú,Ú é   c              3  ó<   K  — | ]  }|j                  «       –— Œ y ­w)N)Úisdigit)Ú.0Úps     ú/app/app/autopost.pyÚ	<genexpr>z&parse_autopost_args.<locals>.<genexpr>   s   è ø€ Ð!=±u°! !§)¡)§+±uùs   ‚zBI need two numbers: the total number of episodes and the interval.r   é   z Both numbers must be at least 1.zThe total can be at most Ú.)ÚreplaceÚsplitÚlenÚallÚ
ValueErrorÚintÚMAX_EPISODES)ÚrawÚpartsÚtotalÚintervals       r   Úparse_autopost_argsr      sž   € àŠY�B×Ñ  SÓ)×/Ñ/Ó1€EÜ
ˆ5ƒz�Q‚œcÑ!=±uÓ!=Ô=ÜÐ]Ó^Ð^Ü˜% ™(“m¤S¨¨q©£]ˆ8€EØˆq‚y�H˜q’LÜÐ;Ó<Ð<ØŒ|ÒÜÐ4´\°NÀ!ÐDÓEÐEØ�(ˆ?Ðó    c                ó2  — | dk  s|dk  rt        d«      ‚g d}}|| k  r0t        ||z   dz
  | «      }|j                  ||f«       |dz   }|| k  rŒ0t        |«      dk\  r:|d   \  }}||z
  dz   }||k  r%|dz  |k  r|j	                  «        |d   d   |f|d<   |S )a  [(first, last), ...] covering 1..total in steps of `interval`.

    The last, shorter range gets its own post when it is longer than half an interval (114 with 20 -> 101 to 114);
    when it is half an interval or less it is added to the post before it (102 with 20 -> 81 to 102).r   z%total and interval must be at least 1r	   éÿÿÿÿr   )r   ÚminÚappendr   Úpop)r   r   ÚrangesÚstartÚendÚaÚbÚsizes           r   Úplan_rangesr*      sÃ   € ð
 ˆq‚y�H˜q’LÜÐ@ÓAÐAØ˜ˆE€FØ
�5Š.Ü�%˜(Ñ" QÑ&¨Ó.ˆØ�‰�u˜c�lÔ#Ø�a‘ˆð �5‹.ô ˆ6ƒ{�aÒØ�b‰z‰ˆˆ1Ø�1‰u�q‰yˆØ�(Š?˜t a™x¨8Ò3Ø�J‰JŒLØ  ™* Q™-¨Ð+ˆF�2‰JØ€Mr   c                ó
   — | d›S )NÚ02d© )Úns    r   Úpadr/   4   s   € Ø�ˆWÐr   c                ó4   — t        | «      › dt        |«      › �S )Nz to )r/   ©r'   r(   s     r   Úspanr2   8   s   € Ü�!‹fˆX�Tœ#˜a›&˜Ð"Ð"r   c                óF   — | |k7  rdt        | |«      › �S dt        | «      › �S )Nz	Episodes zEpisode )r2   r/   r1   s     r   Útitle_ofr4   <   s+   € Ø'(¨A¢vˆY”t˜A˜q“z�lÐ#ÐF°X¼cÀ!»f¸XÐ3FÐFr   c                ó    — t        | |«      › d�S )Nu)   

Click the button below to download ðŸ‘‡©r4   r1   s     r   Ú	post_textr7   @   s   € Ü�q˜!‹nÐÐHÐIÐIr   c                ó    — dt        | |«      › �S )Nz	Download r6   r1   s     r   Úbutton_labelr9   D   s   € Ø”x  1“~Ð&Ð'Ð'r   c                ó$   — t        | |«      |dœggS )N)ÚtÚu)r9   )r'   r(   Úlinks      r   Úpost_buttonsr>   H   s   € Ü  1Ó%¨DÑ1Ð2Ð3Ð3r   c           	     óæ   — | D ��cg c].  \  }}||k7  rt        |«      › dt        |«      › �n
t        |«      ‘Œ0 }}}t        |«      |kD  r|d|dz
   dgz   |dd z   }dj                  |«      S c c}}w )u[   '01â€“20 Â· 21â€“40 Â· 41â€“60 Â· â€¦ Â· 101â€“114' (the middle is left out of long lists).u   â€“Nr	   u   â€¦éþÿÿÿu    Â· )r/   r   Újoin)r$   Úshowr'   r(   r   s        r   Úranges_summaryrC   L   s   € áFLÔMÁf¹d¸aÀ q¨A¢v”�A“ˆx�sœ3˜q›6˜(Ñ#´3°q³6Ñ9Àf€EÑMÜ
ˆ5ƒz�DÒØ�j˜˜q™Ð! U GÑ+¨e°B°C¨jÑ8ˆØ�;‰;�uÓÐùó Ns   †3A-N)r   ÚstrÚreturnÚtuple)r   r   r   r   rE   Úlist)r.   r   rE   rD   )r'   r   r(   r   rE   rD   )r'   r   r(   r   r=   rD   rE   rG   )é   )r$   rG   rB   r   rE   rD   )Ú__doc__Ú
__future__r   ÚPLACEHOLDER_LINKÚ	MAX_POSTSr   ÚUSAGEr   r*   r/   r2   r4   r7   r9   r>   rC   r-   r   r   Ú<module>rN      s^   ðñõ #à)Ð Ø€	Ø€ðCð ó
óó*ó#óGóJó(ð .>ô 4õr   