| from pydantic import BaseModel, Field |
| from typing import List, Optional, Literal |
| from enum import Enum |
|
|
|
|
| class VoiceEnum(str, Enum): |
| """Available TTS voices""" |
| af_heart = "af_heart" |
| af_alloy = "af_alloy" |
| af_aoede = "af_aoede" |
| af_bella = "af_bella" |
| af_jessica = "af_jessica" |
| af_kore = "af_kore" |
| af_nicole = "af_nicole" |
| af_nova = "af_nova" |
| af_river = "af_river" |
| af_sarah = "af_sarah" |
| af_sky = "af_sky" |
| am_adam = "am_adam" |
| am_echo = "am_echo" |
| am_eric = "am_eric" |
| am_fenrir = "am_fenrir" |
| am_liam = "am_liam" |
| am_michael = "am_michael" |
| am_onyx = "am_onyx" |
| am_puck = "am_puck" |
| am_santa = "am_santa" |
| bf_emma = "bf_emma" |
| bf_isabella = "bf_isabella" |
| bm_george = "bm_george" |
| bm_lewis = "bm_lewis" |
| bf_alice = "bf_alice" |
| bf_lily = "bf_lily" |
| bm_daniel = "bm_daniel" |
| bm_fable = "bm_fable" |
|
|
|
|
| class MusicMoodEnum(str, Enum): |
| """Available music moods""" |
| sad = "sad" |
| melancholic = "melancholic" |
| happy = "happy" |
| euphoric = "euphoric/high" |
| excited = "excited" |
| chill = "chill" |
| uneasy = "uneasy" |
| angry = "angry" |
| dark = "dark" |
| hopeful = "hopeful" |
| contemplative = "contemplative" |
| funny = "funny/quirky" |
|
|
|
|
| class OrientationEnum(str, Enum): |
| """Video orientation""" |
| portrait = "portrait" |
| landscape = "landscape" |
|
|
|
|
| class CaptionPositionEnum(str, Enum): |
| """Caption position on video""" |
| top = "top" |
| center = "center" |
| bottom = "bottom" |
|
|
|
|
| class MusicVolumeEnum(str, Enum): |
| """Music volume level""" |
| low = "low" |
| medium = "medium" |
| high = "high" |
| muted = "muted" |
|
|
|
|
| class VideoStatus(str, Enum): |
| """Video processing status""" |
| processing = "processing" |
| ready = "ready" |
| failed = "failed" |
|
|
|
|
| class SceneInput(BaseModel): |
| """Input for a single scene in the video""" |
| text: str = Field(..., description="Text to be narrated in this scene") |
| searchTerms: List[str] = Field(..., description="Keywords for finding background video", alias="searchTerms") |
| |
| class Config: |
| populate_by_name = True |
|
|
|
|
| class RenderConfig(BaseModel): |
| """Configuration for video rendering""" |
| paddingBack: Optional[int] = Field(0, description="End screen duration in milliseconds") |
| music: Optional[MusicMoodEnum] = Field(None, description="Background music mood") |
| captionPosition: CaptionPositionEnum = Field(CaptionPositionEnum.bottom, description="Caption position") |
| captionBackgroundColor: str = Field("blue", description="Caption background color") |
| voice: VoiceEnum = Field(VoiceEnum.af_heart, description="TTS voice") |
| orientation: OrientationEnum = Field(OrientationEnum.portrait, description="Video orientation") |
| musicVolume: MusicVolumeEnum = Field(MusicVolumeEnum.high, description="Background music volume") |
| |
| class Config: |
| populate_by_name = True |
|
|
|
|
| class CreateVideoRequest(BaseModel): |
| """Request to create a short video""" |
| scenes: List[SceneInput] = Field(..., min_length=1, description="List of scenes for the video") |
| config: Optional[RenderConfig] = Field(default_factory=RenderConfig, description="Render configuration") |
|
|
|
|
| class CreateVideoResponse(BaseModel): |
| """Response after creating a video""" |
| videoId: str = Field(..., description="Unique ID for the created video") |
|
|
|
|
| class VideoStatusResponse(BaseModel): |
| """Response for video status check""" |
| status: VideoStatus = Field(..., description="Current status of the video") |
|
|
|
|
| class VideoListItem(BaseModel): |
| """Single video in the list""" |
| id: str |
| status: VideoStatus |
|
|
|
|
| class VideoListResponse(BaseModel): |
| """Response for listing all videos""" |
| videos: List[VideoListItem] |
|
|
|
|
| class Caption(BaseModel): |
| """Caption with timing information""" |
| text: str |
| startMs: int |
| endMs: int |
|
|
|
|
| class Scene(BaseModel): |
| """Processed scene with all media""" |
| captions: List[Caption] |
| video: str |
| audio: dict |
|
|