
    ;@j                        d Z ddlmZ ddlmZ ddlmZ ddlmZ g dZ	d!d"dZ
d#dZd$dZd$dZd%dZd&dZd'dZd(dZd S ))zCShot plan generation for finalized AutoShortsBot voiceover scripts.    )annotations)Path)Any)_slug)first_frame_hookpattern_interruptcore_explanationscreen_or_card_visualctaJ   textstrlimitintreturnc                    d                     |                                           }t          |          |k    r|S |d|                             dd          d                             d          S )z;Return a compact on-screen phrase, preserving strong hooks. N   r   z.,;:)joinsplitlenrsplitrstrip)r   r   cleaneds      Q/home/agent/jarvis_runtime/autoshortsbot/AutoShortsBot/autoshorts/shot_planner.py_split_textr      sb    hhtzz||$$G
7||u6E6?!!#q))!,33F;;;    durationlist[tuple[int, int]]c           	     \   | dk    r+dddt          d| dz
            t          d| dz
            | g}n*dddt          d	| d
z
            t          d| dz
            | g}g }t          ||dd                   D ]-\  }}|                    |t          |dz   |          f           .|dd         S )z=Create five coarse timing windows for a short-form shot plan.-   r                  	         *   
   r   N      )maxzipappend)r   cutswindowsstartends        r   _scene_windowsr5      s    2~~1aRB//RA1F1FQ1aRB//RB1G1GR%'G$QRR)) 5 5
ss519c22344442A2;r   finaldict[str, Any]	list[str]c                B    | d         }|dk    rg dS |dk    rg dS g dS )Npillarai_life_systems)kinetic_textscreen_recordingcard_animationr=   r<   attention_design)r<   stock_brollr>   r=   r<   )r<   generated_backgroundr>   r@   r<    )r6   r:   s     r   _asset_sequencerC   '   sG    8_F"""iiii###ddddddddr   c                J    | d         dk    rg dS | d         dk    rg dS g dS )Nr:   r;   )z[Large kinetic hook text over a messy prompt window; immediate zoom-in on the contradiction.zQFast cut to a real prompt being rewritten from passive question to critic prompt.zXUse simple cards for the key questions; one card changes at a time, no dense paragraphs.z^Screen recording of the final copy-paste prompt with a visible human approval/decision moment.zZEnd card with the comment keyword and one clear action; keep the CTA legible for one beat.r?   )z\Large hook text over a phone/feed freeze-frame; make the first frame readable without audio.zXRelatable stock/B-roll: thumb hovering over an endless feed, then hard cut to greyscale.z^Card animation comparing your incentive vs. the feed incentive; two columns, very little text.zUScreen-style visual showing home screen cleanup, app moved away, timer/exit rule set.zYEnd on the phone home screen question; highlight the app moved off the home screen today.)z>Large kinetic hook text; visible movement in the first second.z?Pattern interrupt with a fast before/after visual state change.z6Use cards to explain the core idea one beat at a time.z@Support the payoff with B-roll or a concrete screen/card visual.z*End with the CTA as readable kinetic text.rB   )r6   s    r   _visual_directionsrE   0   s`    X+++
 
 
 	
 X,,,
 
 
 	
   r   c                 
    g dS )N)zIStop the scroll with self-relevance and tension in the first two seconds.z?Reset attention before the viewer predicts a generic slideshow.z6Deliver the main mental model with low cognitive load.zDShow the concrete payoff so the advice feels usable, not ornamental.zJConvert attention into a comment/save action without adding a second idea.rB   rB   r   r   _retention_goalsrG   J   s       r   c                T   t          t          | d                             }t          |           }t          |           }t	                      }|                     dg           }d | d                             d          D             }d                    |dd                                                   }g }t          t                    D ]\  }	}
||	         \  }}|r,|t          |	t          |          d	z
                     d
         n| d         }|	dk    r|nt          |          }|                    |	d	z   |
||||	         |||	         ||	         d           | d         | d         | d         | d         |                     dg           ||                     dg           dS )zOBuild a five-scene, retention-led shot plan from a finalized voiceover package.estimated_secondscaption_beatsc                ^    g | ]*}|                                 |                                 +S rB   )strip).0parts     r   
<listcomp>z#build_shot_plan.<locals>.<listcomp>[   s2    ]]]tPTPZPZP\P\]djjll]]]r   	voiceover.z. Nr,   r   r   r   )scenepurposer3   r4   
asset_typeon_screen_textvisual_directionretention_goalidtitler:   production_notes)rX   rY   r:   rI   rJ   scenesrZ   )r5   r   rC   rE   rG   getr   r   rL   	enumerateSCENE_PURPOSESminr   r   r0   )r6   r2   asset_types
directionsgoalsbeatshook_sentences	hook_textr[   indexrS   r3   r4   	beat_text	on_screens                  r   build_shot_planri   T   s   S':!;<<==G!%((K#E**JEIIor**E]]u[/A/G/G/L/L]]]N		.!,--3355I#%F#N33 
 
wU^
sAF^E#eSZZ!^445f==ER]L^	!&!IIY1G1G	")%0"+$.u$5"',	 		
 	
 	
 	
 Dkw/"#67?B77!II&8"==  r   planc                   g }| d         D ]a}|                     d|d          d|d          d|d         dd	|d
         dd|d          d|d          d|d          d|d                     bd                    |          }d                    d | d         D                       }d                    d | d         D                       }d| d          d| d          d| d          d| d           d!| d"| d#| dS )$zJFormat a shot plan as Markdown for human review and future renderer input.r[   z
### Scene rR   u    — rS   z

- Timing: r3   02du   s–r4   zs
- Asset type: rT   z
- On-screen text: rU   z
- Visual direction: rV   z
- Retention goal: rW   z


c              3  @   K   | ]}d |d         dd|d          V  dS )- r3   rl   zs: r   NrB   )rM   beats     r   	<genexpr>z#format_shot_plan.<locals>.<genexpr>   s>      bbD?4=???f??bbbbbbr   rJ   c              3      K   | ]	}d | V  
dS )ro   NrB   )rM   notes     r   rq   z#format_shot_plan.<locals>.<genexpr>   s(      GGdk4kkGGGGGGr   rZ   z# rY   z	

- ID: `rX   z`
- Pillar: `r:   z`
- Estimated duration: rI   zs

## Shot plan

z

## Caption beats

z

## Production notes

)r0   r   )rj   scene_blocksrR   r[   rc   notess         r   format_shot_planrv   {   s   Lh 
 
;w ; ;eI.> ; ;wF; ;16uF; ;"<0; ; "''7!8; ; $));#<	; ;
 "''7!8; ;	
 	
 	
 	
 [[&&FIIbbDQ`LabbbbbEIIGGd3E.FGGGGGE$w-  T
  N  /0	       !   r   finalslist[dict[str, Any]]
output_dirr   
list[Path]c                   |                     dd           g }| D ]n}t          |          }||d          dt          |d                    dz  }|                    t	          |          d           |                    |           o|S )	z2Write one Markdown shot plan per finalized script.T)parentsexist_okrX   -rY   z.mdzutf-8)encoding)mkdirri   r   
write_textrv   r0   )rw   ry   pathsr6   rj   paths         r   write_shot_plansr      s    TD111E  u%%tDzEEE$w-,@,@EEEE(..AAATLr   N)r   )r   r   r   r   r   r   )r   r   r   r   )r6   r7   r   r8   )r   r8   )r6   r7   r   r7   )rj   r7   r   r   )rw   rx   ry   r   r   rz   )__doc__
__future__r   pathlibr   typingr   autoshorts.script_draftsr   r^   r   r5   rC   rE   rG   ri   rv   r   rB   r   r   <module>r      s   I I " " " " " "             * * * * * *  < < < < <	 	 	 	e e e e   4   $ $ $ $N       F	 	 	 	 	 	r   