
    nj"              	          d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 ddd	d
d
d
dddZ
d
dd	dddd
d
d	ddddZd*dZd+dZd,dZd-dZd.dZd/dZd0d Zd1d!Zd2d"Zd3d$Zd4d)ZdS )5ag  Asset planning for final, motion-led AutoShortsBot renders.

This layer converts render manifests into explicit asset-generation plans so final
videos can use local procedural motion, screen-recording simulations, kinetic
overlays, and mechanism animations instead of static text slides. The plan is
budget-safe: paid video-credit providers are not required.
    )annotationsN)Path)Any)_slugkinetic_text_overlayscreen_recording_simulationanimated_cardcinematic_ai_videomechanism_animation)kinetic_textscreen_recordingcard_animationstock_brollgenerated_backgroundr
   r   r   )scene_01scene_02scene_03scene_04scene_05)ai_life_systemsattention_designmanifestdict[str, Any]returnlist[dict[str, Any]]c                &    d | d         D             S )Nc                *    g | ]}|d          dk    |S )trackvisual ).0items     O/home/agent/jarvis_runtime/autoshortsbot/AutoShortsBot/autoshorts/asset_plan.py
<listcomp>z!_visual_items.<locals>.<listcomp>1   s&    OOOTT']h5N5ND5N5N5N    timeliner    )r   s    r#   _visual_itemsr'   0   s    OOXj1OOOOr%   r"   int | floatc           	         t          | d                   dz  }|                     d          dv r%|                                rt          |          n|S t          dt	          dt          |                              S )Nduration_msi  type>   r
   r   r         )intget
is_integermaxminround)r"   secondss     r#   _duration_secondsr5   4   sr    $}%&&-Gxx```&1133@s7|||@q#aw(()))r%   pillarstrc                    t                               |i                               | d                   }|r|S t                              | d         d          S )Nidr+   r
   )SCENE_MODE_OVERRIDESr/   SCENE_MODE_BY_TYPE)r"   r6   overrides      r#   _asset_moder=   ;   sQ    #''3377T
CCH !!$v,0DEEEr%   scene_idmodec                6    |dk    rdS |dk    rdS |dk    rdS dS )Nr
   z?slow handheld push-in, subtle parallax, natural micro-movementsr   zQcursor movement, typing reveal, zoom to changed prompt, highlighted selection boxr	   zEcards slide in one at a time, one concept per beat, slight scale popszClarge kinetic caption words pop and slide with beat-synced emphasisr    )r>   r?   s     r#   _camera_motionrA   B   s=    ###PP,,,bbVVPPr%   textc                    | dk    r	 dS 	 dS )Nr   za realistic person holding a phone in a dim modern room, thumb hovering over an endless feed, then a decisive pause as the screen glow reflects on their faceza realistic creator at a desk late evening, laptop open to an AI chat, thoughtful but in control, hands moving between keyboard and notebookr    )r6   rB   s     r#   _cinematic_subjectrD   L   s-    ###N	
 	

	5 r%   c           
     r   |d         }| d         }|dk    r<t          |d         |          }d| d| d          dt          | d	         |           d
S |dk    rd| d          dS |dk    rd| d          dS |dk    r7d| d          d|                     dt          | d	         |                     dS d| S )NvideorB   r
   r6   z4Vertical 9:16 cinematic-looking local motion scene, z|. Mood: focused, modern, high-retention social video, dramatic lighting simulated with gradients and shadows. Scene intent: visual_directionz	 Camera: r9   zq. Use local procedural animation/parallax rather than paid AI-video credits; keep captions renderer-overlay only.r   zdVertical 9:16 UI/screen-recording simulation. Show an AI chat or phone interface being edited live: z Use typing, cursor movement, zoom highlights, and before/after prompt changes. All readable captions must be added by our renderer overlay, not baked into the clip.r	   zwVertical animated explainer card sequence. Minimal dark UI, one idea per beat, animated boxes and arrows. Visual task: z> Keep it moving; no static slide holds longer than one second.r   u   Vertical 9:16 mechanism-reveal animation. Build a clear visual explanation with moving layers, x-ray/röntgen reveal, arrows, meters, object cutaways, and sequential labels added by our renderer. Mechanism task: z	 Motion: visual_motionzV. No static holds longer than one second; keep all readable text as renderer overlays.z{Kinetic text overlay scene. Use large caption words, fast emphasis, scale pops, and clean background motion. Overlay text: )rD   rA   r/   )r"   r   r?   rF   rB   subjects         r#   _generation_promptrJ   X   si   WE<D###$U8_d;;~7 ~ ~!"45~ ~@NtTXz[_@`@`~ ~ ~	
 ,,,d&'d d d	

 u !34u u u	
 $$$c#$67c cBF((?\jkoptkuw{\|\|B}B}c c c	
	 	  	 r%   c                H    | dk    r	 dS | dk    rdS | dk    rdS | dk    rdS d	S )
Nr
   zno readable text, no subtitles, no logos, no watermarks, no distorted hands, no fake UI text, no slideshow, no static image, no uncanny facesr   zZno private data, no real credentials, no illegible tiny UI, no brand logos unless approvedr	   zLno dense paragraphs, no static PowerPoint slide, no tiny text, no chart junkr   zbno static diagram, no dense labels, no tiny text, no unreadable chart junk, no generic infographicz5no long paragraphs, no tiny footnotes, no static cardr    )r?   s    r#   _negative_promptrL   {   sZ    ###>	
 	
 ,,,kk]]$$$ssBBr%   c                   |d         }t          | |d                   }| d         | d         |dt          |           | d         d|dk    t          | d         |          t          | ||          t	          |          | d	         | d
         dS )NrF   r6   r9   	asset_reflocal_free_rendererrB   renderer_overlay_onlyr
   retention_goalrG   )r>   rN   
asset_modeprovider_familyduration_secondsoverlay_textcaption_strategyno_text_in_videomotion_directivegeneration_promptnegative_promptrQ   source_visual_direction)r=   r5   rA   rJ   rL   )r"   r   rF   r?   s       r#   _scene_asset_planr\      s    WEtU8_--DJ+&0-d33V3 $88*4:t<</hEE+D11/0#'(:#;  r%   c                F     fdt                     D             }d |D             }d d         |dddd|                    d	          |                    d
          |                    d          |                    d          |                    d          dddddS )z7Build a final-render asset plan from a render manifest.c                0    g | ]}t          |          S r    )r\   )r!   r"   r   s     r#   r$   z$build_asset_plan.<locals>.<listcomp>   s$    TTTDh//TTTr%   c                    g | ]
}|d          S )rR   r    )r!   scenes     r#   r$   z$build_asset_plan.<locals>.<listcomp>   s    555UU< 555r%   zasset_plan.v2rF   storyboard_onlyfree_only_no_paid_video_creditsr   Tr
   r   r	   r   r   )r
   r   r	   r   r   zGlarge kinetic overlays generated by renderer; no baked text in AI clips)preview_renderer_rolebudget_policystatic_card_limitmust_use_motion_assetspreferred_mixcaptions approval_required_before_publish)schema_versionrF   scenesfinal_render_strategy)r'   count)r   rk   modess   `  r#   build_asset_planro      s    TTTTM(<S<STTTF55f555E)'"%6>!"&*&+kk2F&G&G/4{{;X/Y/Y!&_!=!=',{{3H'I'I(-4J(K(K  b04"
 "
	  r%   rF   c                    t          | d                   }| d         }|                    |          r| dS | d| dS )Ntitler9   z.json-)r   endswith)rF   
title_slugvideo_ids      r#   _asset_plan_filenamerv      sX    uW~&&JT{H$$ "!!!!******r%   	manifests
output_dirr   
list[Path]c                   |                     dd           g }| D ]m}t          |          }|t          |d                   z  }|                    t	          j        |dd          dz   d	           |                    |           n|S )
z Write asset plans as JSON files.T)parentsexist_okrF      F)indentensure_ascii
zutf-8)encoding)mkdirro   rv   
write_textjsondumpsappend)rw   rx   pathsr   planpaths         r#   write_asset_plansr      s    TD111E  ))0g???
4FFFMX_```TLr%   )r   r   r   r   )r"   r   r   r(   )r"   r   r6   r7   r   r7   )r>   r7   r?   r7   r   r7   )r6   r7   rB   r7   r   r7   )r"   r   r   r   r?   r7   r   r7   )r?   r7   r   r7   )r"   r   r   r   r   r   )r   r   r   r   )rF   r   r   r7   )rw   r   rx   r   r   ry   )__doc__
__future__r   r   pathlibr   typingr   autoshorts.script_draftsr   r;   r:   r'   r5   r=   rA   rD   rJ   rL   r\   ro   rv   r   r    r%   r#   <module>r      s    # " " " " "              * * * * * * +5%'0.02	 	  )1#1*  )(#1*   $P P P P* * * *F F F FQ Q Q Q	 	 	 	       FC C C C   (   4+ + + +	 	 	 	 	 	r%   