persona-community-5/pkg/persona/video_spec.go
jordan bd2f591b98
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
Initialize project from skeleton template
2026-02-24 07:39:46 +00:00

93 lines
2.7 KiB
Go

package persona
// VideoSpec defines a single video generation spec for one of the 4 motion types.
type VideoSpec struct {
// MotionType describes the scenario and movement style.
MotionType MotionType `json:"motion_type" yaml:"motion_type"`
// Prompt is the assembled Veo generation prompt.
// Set by the videogen pipeline before calling the video provider.
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"`
// URL is the storage URL of the generated video.
// Set after successful video generation and upload.
URL string `json:"url,omitempty" yaml:"url,omitempty"`
// Status is the current generation status.
Status VideoStatus `json:"status" yaml:"status"`
// Duration is the target video duration (e.g., "5s", "8s").
Duration string `json:"duration" yaml:"duration"`
// AspectRatio is the target aspect ratio ("9:16" vertical, "16:9" horizontal).
AspectRatio string `json:"aspect_ratio" yaml:"aspect_ratio"`
}
// MotionType represents the scenario and movement type for a persona video.
type MotionType string
const (
// MotionSmileReveal is a brief, warm smile moment — ideal for first impressions.
MotionSmileReveal MotionType = "smile_reveal"
// MotionPersonality is an expressive personality showcase moment.
MotionPersonality MotionType = "personality_moment"
// MotionLifestyle is a contextual lifestyle shot showing the persona in their world.
MotionLifestyle MotionType = "lifestyle"
// MotionInvitation is a direct-address invitation or call-to-action moment.
MotionInvitation MotionType = "invitation"
)
// IsValid returns true if the motion type is recognized.
func (m MotionType) IsValid() bool {
switch m {
case MotionSmileReveal, MotionPersonality, MotionLifestyle, MotionInvitation:
return true
default:
return false
}
}
// VideoStatus represents the generation status of a video.
type VideoStatus string
const (
VideoStatusPending VideoStatus = "pending"
VideoStatusQueued VideoStatus = "queued"
VideoStatusComplete VideoStatus = "complete"
VideoStatusFailed VideoStatus = "failed"
)
// DefaultVideoMatrix returns the 4 standard video specs with default durations and aspect ratios.
// Prompts are empty — populated by the videogen pipeline.
func DefaultVideoMatrix() []VideoSpec {
return []VideoSpec{
{
MotionType: MotionSmileReveal,
Duration: "5s",
AspectRatio: "9:16",
Status: VideoStatusPending,
},
{
MotionType: MotionPersonality,
Duration: "8s",
AspectRatio: "9:16",
Status: VideoStatusPending,
},
{
MotionType: MotionLifestyle,
Duration: "8s",
AspectRatio: "16:9",
Status: VideoStatusPending,
},
{
MotionType: MotionInvitation,
Duration: "5s",
AspectRatio: "9:16",
Status: VideoStatusPending,
},
}
}