+
    j                       R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^RI
HtHtHt ]P                  ! 4       R,          t]R,          tR R	 ltR
 R ltR R ltR R ltRR R llt]R8X  d   ]! ]! 4       4      hR# )z%tiktok-live-recorder CLI entry point.)annotationsN)Path)Optional)TikTokLiveRecorderStreamOfflineErrorFfmpegMissingErrorz.tiktok-live-eventszapi-keyc                   V ^8  d   QhRR/# )   returnstr )formats   "Y/var/www/giherryaguirre.org/venv/lib/python3.14/site-packages/tiktok_live_recorder/cli.py__annotate__r      s      #     c                      \         P                  4       '       d%   \         P                  R R7      P                  4       #  R#   \         d     R# i ; i)utf-8encoding )KEY_FILEexists	read_textstrip	Exceptionr   r   r   _load_stored_keyr      sR    ??%%w%7==??    s   A #A AAc                    V ^8  d   QhRRRR/# )r	   keyr   r
   Noner   )r   s   "r   r   r      s     	 	3 	4 	r   c                     \         P                  R R RR7       \        P                  V RR7        \        P
                  ! \        R4       R#   \         d     R# i ; i  \         d     R# i ; i)Ti  )parentsexist_okmoder   r   i  N)
CONFIG_DIRmkdirr   
write_textoschmodr   )r   s   &r   	_save_keyr(      se    5AC'2	HHXu% 		 s.   /A! A AA! AA! !A0/A0c                    V ^8  d   QhRRRR/# )r	   argvOptional[list[str]]r
   zargparse.Namespacer   )r   s   "r   r   r   *   s      ) .@ r   c                   \         P                  ! R RR7      pVP                  RRR7       VP                  RRRR	R
7       VP                  RRR. R"ORR7       VP                  RRR. R#ORR7       VP                  RR\        RRR7       VP                  RRR\         P                  R7       VP                  RRRR R!7       VP                  V 4      # )$ztiktok-live-recorderz4Record any TikTok LIVE stream to MP4 in one command.)progdescriptionusernamez.TikTok username to record (with or without @).)helpz-oz--outout_filezOutput file path.)destr0   z-qz	--qualityoriginz$Preferred quality (default: origin).)defaultchoicesr0   z-cz--containermp4z Output container (default: mp4).z--maxmax_secondsNzStop recording after N seconds.)r2   typer4   r0   z	--api-keyapi_keyr   )r2   r4   r0   z-vz	--verbose
store_truezPrint ffmpeg output.)actionr0   )r3   FULL_HD1HD1SD1SD2)r6   flvtsmkv)argparseArgumentParseradd_argumentintSUPPRESS
parse_args)r*   ps   & r   _parse_argsrJ   *   s    #J	A NN:$TNUNN4z8KNLNN4hF>  @ NN46:  < NN7S$9  ;NN;Y ))  +NN4\.  0<<r   c                    V ^8  d   QhRRRR/# )r	   msgr   r
   boolr   )r   s   "r   r   r   @   s     \ \ \ \r   c                    T ;'       g    R P                  4       pRV9   ;'       g     RV9   ;'       g    RV9   ;'       g    RV9   # )r   	anonymousz
rate-limitz
rate limitzcap reached)lower)rL   ms   & r   _is_rate_limitrR   @   sI    	A![[|q0[[LA4E[[Z[I[[r   c                    V ^8  d   QhRRRR/# )r	   r*   r+   r
   rF   r   )r   s   "r   r   r   E   s     0 0" 0c 0r   c           
     .   \        V 4      pVP                  P                  R 4      P                  4       pVP                  ;'       g    \        4       ;'       g    RpV'       d%   VP                  '       g   \        R\         24       VP                  '       d   \        VP                  4        \        RV R24       \        W#R7      p VP                  VP                  VP                  VP                  VP                  VP                  R R R7      w  rV\        RT RT 24       ^ #   \          d5   p\        R	TP"                   R
2\$        P&                  R7        Rp?^# Rp?i\(         d     \        R\$        P&                  R7        ^# \*         d   p\-        \/        T4      4      '       d   \        R4       \        RT 2\$        P&                  R7       \1        R4      P                  4       pT'       g   \        R4        Rp?^ # Tp\        T4       \        R\         24        Rp?EK  \        RT 2\$        P&                  R7        Rp?^# Rp?i\2         d*   p\        RT 2\$        P&                  R7        Rp?^# Rp?ii ; i)@r   z%[recorder] using stored API key from z[recorder] resolving @z ...)r9   c                    \        R V  24      # )z[recorder] recording -> printrI   s   &r   <lambda>main.<locals>.<lambda>X   s    53KA31O+Pr   c                    \        R V  24      # )z[recorder] finalised rW   rY   s   &r   rZ   r[   Y   s    1Fqc/J)Kr   )r1   quality	containermax_duration_secverboseon_segment_starton_segment_endz[recorder] @z is not currently live.)fileNzN[recorder] ffmpeg is missing. Install it from https://ffmpeg.org/download.htmlz
[limit]   z8[recorder] Paste your API key (or press Enter to quit): z#[recorder] no key entered. Exiting.z[recorder] API key saved to z[recorder] failed: z[recorder] done. duration zs, file )rJ   r/   lstripr   r9   r   rX   r   r(   r   recordr1   r]   r^   r7   r`   r   	unique_idsysstderrr   RuntimeErrorrR   r   inputr   )	r*   argsr/   r9   recr1   durationenew_keys	   &        r   mainrp   E   s   tD}}##C(..0Hll66.066BGt|||5hZ@A|||$,,
&xj56 ;!	!$..!%!1!1!PK ", "HD 	*8*HXJGH5 " 	L-DECJJW! 	bzz# 	c!f%%b	
1#&SZZ8 Z[aac?@!'"4XJ?@'s+#**= 	's+#**=	sV   AD. .J9)E((J5JJJA/II9IJ*J+JJ__main__)N)__doc__
__future__r   rC   r&   rg   pathlibr   typingr   recorderr   r   r   homer#   r   r   r(   rJ   rR   rp   __name__
SystemExitr   r   r   <module>rz      sx    + "  	 
    YY[00
	!	,\
0f z
TV
 r   