
    5i                    x    d Z ddlmZ ddlZddlZddlmZ ddlmZ  ej                  e
      Zd	dZd
dZd
dZy)uF   
Output Formatter – writes the ProductionPlan as Markdown and JSON.
    )annotationsN)Path)ProductionPlanc                .   dj                  g d| j                   d| j                   d| j                   d| j                   d| j
                   d| j                   d| j                   d	| j                   d
| j                   d| j                   d| j                   d| j                   d| j                   d| j                   d| j                   d| j                    d| j"                  xs d d      S )z6Render a single ProductionScene as a Markdown section. z---

### Frame z | u    – z7

| Field | Value |
|-------|-------|
| **Duration** | zs |
| **Camera Shot** | z |
| **Camera Movement** | z |
| **Composition** | z |
| **Environment** | z |
| **Pose / Action** | z |
| **Visual Focus** | z |
| **Mood** | z |
| **Cut at** | z |
| **Transition** | z5 |

#### Image Prompt (copy to image generator)

```
z7
```

#### Video Prompt (copy to video generator)

```
z.
```

#### TTS Text (copy to ElevenLabs)

```
z
```

**Voice direction:** zN/A
)joinscene_number
time_starttime_endduration_secondscamera_shotcamera_movementcompositionenvironmentpose_actionvisual_focusmood	cut_point
transitionimage_promptvideo_prompttts_textvoice_direction)scenes    9/root/.openclaw/workspace/visionaryfx/output_formatter.py_scene_to_markdownr      s   % %  % 
% "% #("2"2!3% 49% :?8H%I% (()%*% &&'%(% ../%0% &&'%(% &&'%(% (()%*% (()%*% jj\%%  %!%  $$%!% &!%*  +%*+%6  7%67%B  C%BC%H ++4u5I%H6I% %    c                `   t        |      }|j                  dd       |dz  }t        | j                  t	        | j
                  dz  d      z        }ddd| j                   d	| j                   d
| j                   d| j
                   dd| j                   d| d| j                   d| j                   d| j                  j                   d| j                  j                   dd| j                  j                   ddg}| j                  D ]  }|j!                  t#        |              |j!                  d       | j$                  D ]  }|j!                  |        |j!                  d       |j'                  dj)                  |      d       t*        j-                  d|       |S )z-Write the production plan as a Markdown file.Tparentsexist_okzproduction_plan.md<   g?z# Video Production Planr   z**Title:** z**Summary:** z**Total Duration:** z (zs)z**Total Frames:** z**Frames/Minute:** ~z**Target Platform:** z**Character Template:** z**Resolution:** )z	**FPS:** z	## Framesz
## Assembly Instructions
z1
---
*Generated by AI Video Production Pipeline*
r   utf-8encodingzMarkdown saved: %s)r   mkdirroundtotal_scenesmaxtotal_duration_secondstitlesummarytotal_duration_formattedtarget_platformcharacter_template_nameexport_settings
resolutionaspect_ratiofpsscenesappendr   assembly_instructions
write_textr	   loggerinfo)plan
output_dirmd_pathfpmlinesr   instructions          r   save_markdownrB   :   s   j!JTD1//G
C ; ;b @#FFC "

djj\"
~&
t<<= >''(	,
T../0
se$
 4 456
"4#?#?"@A
4//::; <  --.a	1
D((,,-.
E$  0'./0 
LL/011 "[!" 
LLGHtyy'':
KK$g.Nr   c                    t        |      }|j                  dd       |dz  }|j                  t        j                  | j                         dd      d       t        j                  d	|       |S )
z)Write the production plan as a JSON file.Tr    zproduction_plan.json   F)indentensure_asciir%   r&   zJSON saved: %s)r   r(   r9   jsondumps
model_dumpr:   r;   )r<   r=   	json_paths      r   	save_jsonrK   c   sn    j!JTD133I

4??$QUC   KK ),r   )returnstr)r<   r   r=   z
str | PathrL   r   )__doc__
__future__r   rG   loggingpathlibr   modelsr   	getLogger__name__r:   r   rB   rK    r   r   <module>rV      s>    #    !			8	$'T&Rr   