
    Lj                     R   d dl Z d dlZd dlZd dlZd dlmZ d dlmZ  ed          Z ed          Zedz  Z	edz  Z
d Zd	 Zd
 Z e j        edz                      d                    d         dd         Zg Z	 d eD             Zesned          Z eded         z               ee          Ze                    e            eded          ded                     ed         dk    r,de                    dd                                          vrnd eD             sdnded eD             dZe
                     e j        ed d!"          d            e e j        ed d!"                      eed                             d#          rd nd$          )%    N)datetime)PathzT/data/video-pipeline/Youtube-Video-Maker/Project/31052026-001-Nguyen-Hue-Quang-TrungzD/home/hermes/.hermes/skills/media/gen-img-gpt/scripts/gen_img_gpt.pyz"logs/step06_first50_images_run.logz/logs/step06_first50_minimal_retry_manifest.jsonc                    dt          j                                        d           d|  }t          |d           t                              dd	          5 }|                    |d
z              d d d            d S # 1 swxY w Y   d S )N[seconds)timespecz] T)flushautf-8encoding
)r   now	isoformatprintLOGopenwrite)msglinefs      /data/video-pipeline/Youtube-Video-Maker/Project/31052026-001-Nguyen-Hue-Quang-Trung/scripts_retry_step06_first50_minimal_no_refs.pylogr      s    	BX\^^%%y%99	B	BS	B	BD	$d	#w	'	'@1aggd4i.@.@.@@@@@@@@@@@@@@@@@@@s   BBBc                     |                      d          p|                      dd          }|                      d          dk    rd| dS d| d	S )
N	narrationtext typeheadingzVietnamese old-calligraphy chapter title card, 16:9 horizontal, warm antique paper, subtle ink wash, small seal stamp accent, airy breathing room. Exact title: z.. No modern typography, no logo, no watermark.a  Vietnamese historical ink-wash storytelling illustration, 16:9 horizontal canvas, centered irregular ink-wash window on warm antique cream paper, painted content only 65-70 percent of page with 30-35 percent antique paper negative space. Late 18th-century Dai Viet, Tay Son era, historically grounded Vietnamese clothing, terrain, villages, courts, armies, river geography. One cinematic narrative scene matching this narration beat: z. Clear focal action, environment, emotional staging. Not character sheet, not multiple views, not modern, not logo, not watermark, not text, not edge-to-edge, not glossy 3D.)get)sns     r   promptr#      s    eeK,AEE&,,AuuV}}i d  st  d  d  d  	d r	  AB  r	  r	  r	  r	    c                    | d         }t           dz  | dz  }|                                r"|                                j        dk    r|ddS t          j        t          t                    dt          |           dt          |          d	d
dd
dd
ddddddg}t          j
        |ddd          }|j        dk    r|d|j        p|j        dd          dS |d|                                r|                                j        nddS )Nscene_idimages/scenes.pngi  exists)r&   statusz--promptz--outputz--sizeautoz	--qualityz--backgroundz--image-detailhighz--output-formatpngz--n1Tih  )r   capture_outputtimeoutr   failedi)r&   r*   error	generated)r&   r*   bytes)PROJECTr)   statst_sizesys
executablestr
GEN_SCRIPTr#   
subprocessrun
returncodestderrstdout)r!   sidoutcmdps        r   genrE      s4   	*C7?2c<<<?s
zz||Z

*4//CQY8Z8Z1Z	J
6!99ZCQYZ`alms  uC  DJ  K[  \b  ct  uz  {@  AD  	ECnSd$sCCCA|Q3!(J^VWV^`e`f`fIghhhKcjjll8a

8J8J`abbbr$   zscript/scenes.jsonr   r   scenes2   Tc                 b    g | ],}t           d z  |d          dz                                  *|-S r'   r&   r(   r5   r)   .0r!   s     r   
<listcomp>rM   $   s@    ```1w'>!J-?U?U?U'U&]&]&_&_`Q```r$   zMinimal retry r&   zMinimal  r*   r1   
terminatedr2   r   c                 b    g | ],}t           d z  |d          dz                                  *|-S rI   rJ   rK   s     r   rM   rM   -   sz      <P  <P  <P!V]^mVmqrs}q~  oE  oE  oE  WE  VM  VM  VO  VO  <PA  <P  <P  <Pr$   #completed_limited_50_pending_review
incompletec                 n    g | ]2}t           d z  |d          dz                                  *|d         3S rI   rJ   rK   s     r   rM   rM   -   s      Ii  Ii  Ii  \]  pw  xG  pG  KL  MW  KX  H^  H^  H^  p^  of  of  oh  oh  Ii  JK  LV  JW  Ii  Ii  Iir$   )r*   resultsremaining_missingF   )ensure_asciiindent	completed   )jsonosr<   r8   r   pathlibr   r5   r;   r   MANr   r#   rE   loads	read_textrF   rT   missingr!   rappendr    lowerrB   
write_textdumpsr   
SystemExit
startswith r$   r   <module>rj      s    				     



            cdd4VWW
00==A A A
r	 r	 r	c c c tz7//::G:LLMMhWX[Y[X[\
	`````GEajAC:&'''	c!ffAgnnQ%M*%M%M(%M%M!N!N!N{HquuWR00668888%	 <P  <Pv  <P  <P  <P  b33  Vb  mt  Ii  Ii  ag  Ii  Ii  Ii  j  j ztz#5:::G L L L jdj%q111 2 2 2jc(m..{;;BCC Cr$   