
    ^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
Z
d(dZd)d*dZd+dZd,dZd-dZd.dZd/d Z	 d0d1d'ZdS )2zBDeterministic voiceover finalizer for curated AutoShortsBot ideas.    )annotationsN)Path)Any)_sluga@  Stop asking AI to think for you. Ask it to argue with you. Most people use AI like a vending machine: type a question, get a confident answer, move on. That is the weakest use case. Try this instead: paste your idea and ask, what assumptions am I making? What is the weakest part? What would a smart critic disagree with? Now AI is not replacing your thinking. It is putting resistance against lazy thinking. You still decide. You still own the consequence. But you arrive sharper, because the first version had to survive a fight. Comment CRITIC if you want the exact prompt.a&  If your brain has 47 tabs open, paste the mess into this four-box prompt. Do not ask AI to motivate you. Ask it to sort the noise. First, dump everything: tasks, worries, random reminders, half-decisions, all of it. Then ask AI: split this into four boxes. Box one: tasks I can actually do. Box two: worries I cannot solve right now. Box three: decisions I need to make. Box four: later, not today. Then ask one final question: what is the next action that takes less than two minutes? That is the whole trick. You are not looking for a perfect life plan. You are looking for one clean handle on the chaos. When the output appears, do only the two-minute action first. If it still feels too big, shrink it again. Momentum beats clarity. Comment RESET if you want me to turn this into a copy-paste template.a  The algorithm does not need you happy. It needs you to stay. That does not mean every app is evil. It means the incentives are not the same as yours. You want focus, sleep, actual progress, maybe a quiet brain for once. The feed wants one more swipe. So stop fighting a machine with vibes. Change the design. First, turn your phone to greyscale when you need deep work. Second, remove your worst app from the home screen. Do not delete it if that feels dramatic. Just make it less automatic. Third, before you open a feed, set a leaving cue: one search, three videos, or five minutes. If there is no exit rule, the app owns the exit. This is not about becoming a monk. It is about making your phone slightly less talented at stealing your day. Which app gets moved off your home screen today?)zai-004zai-005zattention-002textstrreturnintc                F    t          t          j        d|                     S )Nz\b[\w'-]+\b)lenrefindall)r   s    X/home/agent/jarvis_runtime/autoshortsbot/AutoShortsBot/autoshorts/voiceover_finalizer.py_word_countr      s    rz.$//000       
word_countwords_per_minutec                ,    t          | |z  dz            S )N<   )round)r   r   s     r   _estimate_secondsr      s    ..3444r   ideadict[str, Any]c                :    | d          d| d          d| d          S )z(Fallback finalizer for non-custom ideas.hookz Here is the useful part. script_outlinezY Do not turn this into another idea you save and forget. Try the smallest version today. cta )r   s    r   _generic_voiceoverr       s@     < 	 	$()9$:	 	 ;	 	r   	voiceoverdurationlist[dict[str, Any]]c           	         d t          j        d|           D             }|sg S t          dt          |t	          |          z                      }g }d}|D ]}|                    ||d           ||z  } |S )Nc                ^    g | ]*}|                                 |                                 +S r   )strip).0parts     r   
<listcomp>z"_caption_beats.<locals>.<listcomp>%   s2    ```$SWS]S]S_S_````r   z(?<=[.!?])\s+   r   )startr   )r   splitmaxr   r   append)r!   r"   	sentencesstepbeatscurrentsentences          r   _caption_beatsr4   $   s    ``"(3CY*O*O```I 	q%3y>>12233D"$EG  w99:::4Lr   estimated_seconds	list[str]c                    g d}|dk    r|                     d           | d         dk    r|                     d           | d         dk    r|                     d           |S )	N)z=First frame must show the hook as large kinetic caption text.z=Use motion or a visual state change in the first 1-2 seconds.z]Avoid static AI slideshow visuals; use screen recordings, cards, timer, or before/after cuts.r   zFKeep this version above 60 seconds for TikTok Creator Rewards testing.pillarai_life_systemszMShow the human approval/decision moment; do not imply AI has final authority.attention_designz:Avoid moral panic; frame as attention design and defaults.)r.   )r   r5   notess      r   _production_notesr<   1   s~      E
 B]^^^H~***deeeH~+++QRRRLr   c                   t                               | d         t          |                                                     }t	          |          }t          |          }t          | d                   dk    rdnd}| d         | d         | d         t          | d                   ||||t          ||          | d         | d	         | d
         t          | |          dS )zBCreate a final spoken script and production metadata for one idea.idduration_secondsr   zTikTok Rewards CandidatezGrowth Shortr8   titlevisual_conceptcaptionr   )r>   r8   r@   target_secondsr5   platform_noter   r!   caption_beatsrA   rB   r   production_notes)	TOP3_CUSTOM_VOICEOVERSgetr    r&   r   r   r
   r4   r<   )r   r!   r   r5   rD   s        r   finalize_voiceoverrI   @   s    &**4:7I$7O7OPPVVXXIY''J)*5525d;M6N2O2OSU2U2U..[iM 4jx.gd#5677.& '	3DEE/0	?E{-d4EFF  r   finalc                n   d                     d | d         D                       }d                     d | d         D                       }d| d          d| d	          d
| d          d| d          d| d          d| d          d| d          d| d          d| d| d          d| d          d| d          d| dS )z+Format final voiceover package as Markdown.
c              3  @   K   | ]}d |d         dd|d          V  dS )- r+   02dzs: r   Nr   )r'   beats     r   	<genexpr>z&format_final_script.<locals>.<genexpr>Z   s>      ccD?4=???f??ccccccr   rE   c              3      K   | ]	}d | V  
dS )rN   Nr   )r'   notes     r   rQ   z&format_final_script.<locals>.<genexpr>[   s(      HHdk4kkHHHHHHr   rF   z# r@   z	

- ID: `r>   z`
- Pillar: `r8   z`
- Target duration: rC   z"s
- Estimated voiceover duration: r5   zs
- Word count: r   z
- Platform note: rD   z

## Voiceover

r!   z

## Caption beats

z

## Visual concept

rA   z

## Caption

rB   z


## CTA

r   z

## Production notes

)join)rJ   r1   r;   s      r   format_final_scriptrU   X   sQ   IIccERaLbcccccEIIHHe4F.GHHHHHE %.    d    (O    *+	   
 "'':!;    \"    (    {       & '   . y/   6 u7   > ?       r   batch
output_dirr   selected_idslist[str] | None
list[Path]c                ~   t          |pg           }|                    dd           g }|                     dg           D ]{}|r|d         |vrt          |          }||d          dt	          |d                    dz  }|                    t          |          d	           |                    |           ||S )
z1Write final voiceover scripts for selected ideas.T)parentsexist_okideasr>   -r@   z.mdzutf-8)encoding)setmkdirrH   rI   r   
write_textrU   r.   )rV   rW   rX   selectedpathsr   rJ   paths           r   write_final_scriptsrg      s     <%2&&HTD111E		'2&&   	T
(22"4((uT{GGU5>-B-BGGGG+E22WEEETLr   )r   r   r	   r
   )r   )r   r
   r   r
   r	   r
   )r   r   r	   r   )r!   r   r"   r
   r	   r#   )r   r   r5   r
   r	   r6   )r   r   r	   r   )rJ   r   r	   r   )N)rV   r   rW   r   rX   rY   r	   rZ   )__doc__
__future__r   r   pathlibr   typingr   autoshorts.script_draftsr   rG   r   r   r    r4   r<   rI   rU   rg   r   r   r   <module>rm      s7   H H " " " " " " 				             * * * * * * U	 { t  1 1 1 15 5 5 5 5   
 
 
 
      0$ $ $ $P OS      r   