52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
|
|
from enum import Enum
|
||
|
|
from typing import Optional
|
||
|
|
from pydantic import BaseModel, Field
|
||
|
|
|
||
|
|
|
||
|
|
class VideoMode(str, Enum):
|
||
|
|
SHORTS = "shorts"
|
||
|
|
FULL = "full"
|
||
|
|
|
||
|
|
|
||
|
|
class Difficulty(str, Enum):
|
||
|
|
EASY = "easy"
|
||
|
|
MEDIUM = "medium"
|
||
|
|
HARD = "hard"
|
||
|
|
|
||
|
|
|
||
|
|
class QuizItem(BaseModel):
|
||
|
|
anime: str = Field(..., description="Anime title")
|
||
|
|
opening_file: str = Field(..., description="Filename of the opening audio")
|
||
|
|
start_time: float = Field(0, description="Start time in seconds for audio clip")
|
||
|
|
difficulty: Difficulty = Difficulty.MEDIUM
|
||
|
|
poster: Optional[str] = Field(None, description="Poster image filename")
|
||
|
|
|
||
|
|
|
||
|
|
class GenerateRequest(BaseModel):
|
||
|
|
mode: VideoMode = VideoMode.SHORTS
|
||
|
|
questions: list[QuizItem] = Field(..., min_length=1, max_length=20)
|
||
|
|
audio_duration: float = Field(3.0, ge=1.0, le=10.0, description="Audio clip duration in seconds")
|
||
|
|
background_video: Optional[str] = Field(None, description="Background video filename")
|
||
|
|
transition_sound: Optional[str] = Field(None, description="Transition sound filename")
|
||
|
|
continue_audio: bool = Field(False, description="Continue audio from where question ended instead of restarting")
|
||
|
|
|
||
|
|
|
||
|
|
class GenerateResponse(BaseModel):
|
||
|
|
success: bool
|
||
|
|
video_url: Optional[str] = None
|
||
|
|
filename: Optional[str] = None
|
||
|
|
error: Optional[str] = None
|
||
|
|
|
||
|
|
|
||
|
|
class ProgressResponse(BaseModel):
|
||
|
|
status: str
|
||
|
|
progress: float
|
||
|
|
message: str
|
||
|
|
|
||
|
|
|
||
|
|
class ContentListResponse(BaseModel):
|
||
|
|
audio_files: list[str]
|
||
|
|
background_videos: list[str]
|
||
|
|
posters: list[str]
|
||
|
|
transition_sounds: list[str]
|