Documentation
¶
Overview ¶
Package onair owns owner looks, assets, reels and background master clips.
Index ¶
- Constants
- Variables
- func BoundaryDeadline(ctx context.Context) (time.Time, bool)
- func ServeFont(w http.ResponseWriter, r *http.Request)
- func ServeSystemScreens(w http.ResponseWriter, r *http.Request)
- func WithBoundaryDeadline(ctx context.Context, at time.Time) context.Context
- type Asset
- type Brand
- type Chatter
- type ClipUploadMetadata
- type ImportJob
- type ImportRequest
- type LibraryAsset
- type LibraryUse
- type Look
- type Options
- type Pack
- type PluginContentCache
- type PluginSegment
- type Progress
- type Reel
- type ReelClip
- type RoleConfig
- type SceneSound
- type SceneVideo
- type Service
- func (s *Service) AssetMetadata(ctx context.Context, digest string) (Asset, error)
- func (s *Service) Assets(ctx context.Context) ([]Asset, error)
- func (s *Service) Clip(_ context.Context, r core.ClipRequest) (core.ClipRef, bool)
- func (s *Service) Close()
- func (s *Service) Crossfade(look, moment string) bool
- func (s *Service) DeleteAsset(ctx context.Context, d string) error
- func (s *Service) DeleteClip(ctx context.Context, reel, id string) error
- func (s *Service) DeleteLook(ctx context.Context, id string) error
- func (s *Service) DeleteReel(ctx context.Context, id string) error
- func (s *Service) Draft(ctx context.Context, l Look) (Look, error)
- func (s *Service) Duration(id, m string) (time.Duration, bool)
- func (s *Service) Ensure(_ context.Context, r core.ClipRequest)
- func (s *Service) ExportStylePack(ctx context.Context, id string) ([]byte, []string, error)
- func (s *Service) Generate(ctx context.Context, prompt, summary string, base Look) (Look, error)
- func (s *Service) GenerateScene(ctx context.Context, prompt, summary string, base Look, sceneID string) (Look, error)
- func (s *Service) Handler(resources ...func(chi.Router)) http.Handler
- func (s *Service) Import(ctx context.Context, reel string, in ImportRequest) ([]ImportJob, error)
- func (s *Service) ImportStyleFiles(ctx context.Context, packID string, files map[string][]byte) (Look, error)
- func (s *Service) ImportStylePack(ctx context.Context, raw []byte) (Look, error)
- func (s *Service) Library(ctx context.Context) ([]LibraryAsset, error)
- func (s *Service) LibraryRoutes(r chi.Router)
- func (s *Service) LiveStatic(ctx context.Context, r core.ClipRequest) bool
- func (s *Service) Look(ctx context.Context, id string) (Look, error)
- func (s *Service) Looks(ctx context.Context) ([]Look, error)
- func (s *Service) Overlay(ctx context.Context, r core.ClipRequest) (scene.Document, raster.Bindings, bool)
- func (s *Service) Reel(ctx context.Context, id string) (Reel, error)
- func (s *Service) ReelClipPath(ctx context.Context, reelID, clipID string) (string, bool)
- func (s *Service) ReelSnapshot(ctx context.Context, id string) (Reel, error)
- func (s *Service) Reels(ctx context.Context) ([]Reel, error)
- func (s *Service) RenderLead(look, moment string) time.Duration
- func (s *Service) SaveLook(ctx context.Context, l Look) (Look, error)
- func (s *Service) SaveReel(ctx context.Context, r Reel) (Reel, error)
- func (s *Service) SegmentInfo(moment string) (name, rating string, ok bool)
- func (s *Service) Start()
- func (s *Service) StudioRoutes(r chi.Router)
- func (s *Service) StyleScreens(id string) *config.LiveTVScreens
- func (s *Service) Template(ctx context.Context, prompt string, base Look) (Look, error)
- func (s *Service) Templates(_ context.Context) ([]TemplateRecord, error)
- func (s *Service) UploadAsset(ctx context.Context, name, kind, license string, r io.Reader) (Asset, error)
- func (s *Service) UploadClip(ctx context.Context, reel, name string, r io.Reader, ...) (ReelClip, error)
- type StyleControl
- type StyleScene
- type TemplateRecord
Constants ¶
const StyleDraftGuide = `` /* 1794-byte string literal not displayed */
StyleDraftGuide is the renderer contract shared by generation and live agent drafts.
Variables ¶
var ErrNotFound = errors.New("onair: not found")
var ErrUsed = errors.New("onair: asset is in use")
Functions ¶
func ServeFont ¶
func ServeFont(w http.ResponseWriter, r *http.Request)
MCP exclusion: these owner-authenticated routes supply immutable rendering resources to the console. They do not expose owner records or mutations; fetching binary fonts and bundled scene data has no useful agent tool analogue.
func ServeSystemScreens ¶
func ServeSystemScreens(w http.ResponseWriter, r *http.Request)
Types ¶
type Asset ¶
type Asset struct {
Source string `json:"source,omitempty"`
Attribution string `json:"attribution,omitempty"`
Status string `json:"status,omitempty"`
Progress float64 `json:"progress,omitempty"`
Error string `json:"error,omitempty"`
Digest string `json:"digest"`
Name string `json:"name"`
Kind string `json:"kind"`
Size int64 `json:"size"`
License string `json:"license,omitempty"`
UsedBy []string `json:"usedBy"`
URL string `json:"url,omitempty"`
MIME string `json:"-"`
DurationMS int64 `json:"durationMs,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
}
type Brand ¶
type Brand struct {
Palette struct {
Background string `json:"background"`
Accent string `json:"accent"`
Text string `json:"text"`
Glow string `json:"glow"`
} `json:"palette"`
Type struct {
Display string `json:"display"`
Body string `json:"body"`
} `json:"type"`
Energy float64 `json:"energy"`
Textures []string `json:"textures"`
Tagline string `json:"tagline"`
Language string `json:"language"`
Logo string `json:"logo,omitempty"`
}
type Chatter ¶
type Chatter interface {
Enabled() bool
Chat(context.Context, []llm.Message, bool) (string, error)
}
Chatter is the owner's configured model. Proposals never save records.
type ClipUploadMetadata ¶
ClipUploadMetadata preserves provenance when a local file is imported into a reel.
type ImportJob ¶
type ImportJob struct {
UseSourceTitle bool `json:"useSourceTitle,omitempty"`
ID string `json:"id"`
Source string `json:"source"`
Attribution string `json:"attribution,omitempty"`
Name string `json:"name"`
Kind string `json:"kind"`
Status string `json:"status"`
Progress float64 `json:"progress"`
Error string `json:"error,omitempty"`
}
type ImportRequest ¶
type ImportRequest struct {
URL string `json:"url"`
URLs []string `json:"urls"`
Name string `json:"name"`
Kind string `json:"kind"`
}
Import jobs share the bounded background queue with look preparation. No network request or media probe runs on the console request goroutine.
type LibraryAsset ¶
type LibraryAsset struct {
Asset
MIME string `json:"mime"`
UsedBy []LibraryUse `json:"usedBy"`
CreatedAt int64 `json:"createdAt"`
}
type LibraryUse ¶
type Look ¶
type Look struct {
ID string `json:"id"`
Name string `json:"name"`
Template string `json:"template"`
Brand Brand `json:"brand"`
Roles map[string]RoleConfig `json:"roles"`
Scenes []StyleScene `json:"scenes"`
Controls []StyleControl `json:"controls"`
ChannelIDs []string `json:"channelIds"`
ChannelCount int `json:"channelCount"`
Bug *core.BugSettings `json:"bug,omitempty"`
Screens *config.LiveTVScreens `json:"screens,omitempty"`
Pack *Pack `json:"pack,omitempty"`
Render *Progress `json:"render,omitempty"`
}
type Options ¶
type Options struct {
// Changed runs after an owner style save has committed and locks are released.
Changed func(context.Context) error
StyleChannels func(context.Context) (map[string][]string, error)
ReelChannels func(context.Context) (map[string][]string, error)
PluginSegment func(string) (PluginSegment, bool)
StaticRequests func(context.Context, string) []core.ClipRequest
DB *sql.DB
Chat Chatter
Dir string
FFmpeg func() string
Probe func(context.Context, string) (*core.MediaInfo, error)
Acquire func(context.Context) (context.Context, func(), error)
Bindings func(context.Context, string, string, time.Time) (any, error)
// Upcoming supplies requests for the next three hours of watched channels.
Upcoming func(context.Context) []core.ClipRequest
Logger *slog.Logger
CacheBytes int64
WorkingSize func() (int, int)
Artwork func(context.Context, string) (image.Image, error)
// Render is a seam for verifying that Ensure never executes work inline.
Render func(context.Context, scene.Document, raster.Bindings, string) error
}
type PluginContentCache ¶
type PluginContentCache struct {
// contains filtered or unexported fields
}
PluginContentCache connects the host's background publisher to render readers. Values are immutable after publication; the cache owns the map itself.
func NewPluginContentCache ¶
func NewPluginContentCache() *PluginContentCache
func (*PluginContentCache) EnablePlugin ¶
func (c *PluginContentCache) EnablePlugin(plugin string)
func (*PluginContentCache) Lookup ¶
func (c *PluginContentCache) Lookup(id string) (PluginSegment, bool)
func (*PluginContentCache) Publish ¶
func (c *PluginContentCache) Publish(values map[string]PluginSegment)
func (*PluginContentCache) RemovePlugin ¶
func (c *PluginContentCache) RemovePlugin(plugin string)
type PluginSegment ¶
type PluginSegment struct {
Document scene.Document
Slots map[string]string
Images map[string]image.Image
Version string
Expires time.Time
Rating string
Name string
}
PluginSegment is an immutable background-loaded snapshot. Lookup must do no I/O. Expiry gates playback and rendering, never the declared schedule duration.
type Reel ¶
type Reel struct {
Anchor time.Time `json:"-"`
ID string `json:"id"`
Name string `json:"name"`
Order string `json:"order"`
RepeatHours float64 `json:"repeatHours"`
LoudnessMatch bool `json:"loudnessMatch"`
TrimSilence bool `json:"trimSilence"`
Clips []ReelClip `json:"clips"`
ChannelIDs []string `json:"channelIds"`
}
type ReelClip ¶
type ReelClip struct {
Source string `json:"source,omitempty"`
Attribution string `json:"attribution,omitempty"`
ID string `json:"id"`
Name string `json:"name"`
DurationMS int64 `json:"durationMs"`
SourceDigest string `json:"sourceDigest,omitempty"`
Status string `json:"status"`
Progress float64 `json:"progress,omitempty"`
Size int64 `json:"size,omitempty"`
Preview string `json:"preview,omitempty"`
Error string `json:"error,omitempty"`
}
type RoleConfig ¶
type RoleConfig struct {
Duration float64 `json:"duration"`
}
type SceneSound ¶
type SceneVideo ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AssetMetadata ¶
AssetMetadata reads one asset's stored facts by digest: a single indexed row, with no usage scan, no content read and no probing. Duration is 0 until the asset has been probed.
func (*Service) Crossfade ¶
Crossfade is read from saved look metadata by the background input planner.
func (*Service) DeleteClip ¶
func (*Service) ExportStylePack ¶
ExportStylePack uses the plugin package digest and data runtime; no executable files, credentials, viewers or channel bindings leave this server.
func (*Service) GenerateScene ¶
func (*Service) Handler ¶
Handler must be mounted behind the application's owner authentication and CSRF guard, like livetv.Handler. MCP exclusions: these routes are console designer transport. Binary assets, multipart clips and previews cannot be represented by JSON MCP tools; look/reel transport accompanies the visual stage and explicit Save. Agent look drafts/saves use the separate proposal-backed builtin tools. Bindings is an ephemeral stage preview; it does not mutate server state. ResourceRoutes mounts W6's font and family resource handlers on this router.
func (*Service) ImportStyleFiles ¶
func (s *Service) ImportStyleFiles(ctx context.Context, packID string, files map[string][]byte) (Look, error)
ImportStyleFiles is the plugin install bridge for upload, URL and Marketplace.
func (*Service) ImportStylePack ¶
func (*Service) LibraryRoutes ¶
func (*Service) LiveStatic ¶
LiveStatic reports readiness without requiring a rendered clip for a scene whose analogue background is supplied continuously by the Signal engine.
func (*Service) Overlay ¶
func (s *Service) Overlay(ctx context.Context, r core.ClipRequest) (scene.Document, raster.Bindings, bool)
Overlay prepares an immutable scene and decoded resources for the playout background planner. It never renders; frame ticks evaluate the pure renderer.
func (*Service) ReelClipPath ¶
ReelClipPath reads clip metadata and the local master index. A miss is materialized by the background queue, and the caller skips it until a later planning pass.
func (*Service) ReelSnapshot ¶
ReelSnapshot reads the durable owner clip ordering and conversion states.
func (*Service) RenderLead ¶
RenderLead reflects measured 1080p master work, including slot contention. Every channel decodes these same masters; lower-resolution outputs inherit the conservative native-resolution estimate. Cached repeats need no work.
func (*Service) SegmentInfo ¶
SegmentInfo supplies immutable policy metadata without accessing the database.
func (*Service) Start ¶
func (s *Service) Start()
Start begins workers after application dependencies have been constructed.
func (*Service) StudioRoutes ¶
func (*Service) StyleScreens ¶
func (s *Service) StyleScreens(id string) *config.LiveTVScreens
StyleScreens reads the cached owner style; it performs no rendering or database work.
func (*Service) Templates ¶
func (s *Service) Templates(_ context.Context) ([]TemplateRecord, error)
func (*Service) UploadAsset ¶
type StyleControl ¶
type StyleScene ¶
type StyleScene struct {
ID string `json:"id"`
Role string `json:"role"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Weight int `json:"weight"`
Document scene.Document `json:"document"`
Sounds []SceneSound `json:"sounds"`
Video *SceneVideo `json:"video,omitempty"`
}
func (*StyleScene) UnmarshalJSON ¶
func (s *StyleScene) UnmarshalJSON(b []byte) error
Every owned document goes through the strict, cost-limited scene decoder.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package encode writes content-addressed On Air master clips off request paths.
|
Package encode writes content-addressed On Air master clips off request paths. |
|
Package families embeds the built-in scene documents; families are data.
|
Package families embeds the built-in scene documents; families are data. |
|
Package fonts provides embedded OFL faces.
|
Package fonts provides embedded OFL faces. |
|
Package raster renders scene v1 with no I/O, global mutable state or frame goroutines.
|
Package raster renders scene v1 with no I/O, global mutable state or frame goroutines. |
|
Package scene defines the portable, executable-code-free On Air document v1.
|
Package scene defines the portable, executable-code-free On Air document v1. |
|
Package signal produces live, deterministic signal screens without clip loops or per-tick allocations.
|
Package signal produces live, deterministic signal screens without clip loops or per-tick allocations. |