Documentation
¶
Overview ¶
Package api is a disc module's own HTTP API and SDUI sources (module API 5): a disc's page, why a title is its film and the choice of another, the names given to its titles and chapters, and its sections on a title's page in every app. WittyMediaServer passes the routes on at /api/modules/<module>/... once it has checked who may call them (integration.json).
What a disc holds and which title is its film rests on what only the server keeps and checks: the scan's ranking and an administrator's choice are columns of the server's item, which its own disc sessions play from, and every answer of the disc engine is read in a helper of its own and checked by the server (its scramble and AACS guards stay the server's). So this asks the host API, on behalf of the person asking (/host/v1/discs/...), and shows the answer. The names given to titles and chapters are this module's own, in its own database.
The same files are in WittyDVD and WittyBluray (Config says which): they move into WittyDisc with its next release.
Index ¶
Constants ¶
const ( CommandChoose = commands.Choose CommandClearChoice = commands.ClearChoice CommandRank = commands.Rank CommandCompare = commands.Compare )
Commands, after "<module>.": its own routes, which check again who is asking.
const DataEnv = "WITTYMODULE_DATA"
DataEnv is where the server says the module's own folder is.
const DataFormat = 1
DataFormat is this database's form, as module.json's dataFormat says.
const File = "labels.db"
File is the database's name in the module's data folder.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Analysis ¶
type Analysis struct {
Kind string `json:"kind"` // dvd or bluray
// Ranked: the engine gave a ranking; without one, the main title is the older rule's pick.
Ranked bool `json:"ranked"`
// Pending: the ranking is being worked out on a server set to go easy on its machine.
Pending bool `json:"pending"`
// Main is what Play plays; EngineMain the engine's own pick; -1 when there is none.
Main int `json:"main"`
EngineMain int `json:"engineMain"`
Chosen json.RawMessage `json:"chosen"`
ChosenBy string `json:"chosenBy,omitempty"`
Rank json.RawMessage `json:"rank"`
CanChoose bool `json:"canChoose"`
RankError string `json:"rankError,omitempty"`
Protected bool `json:"protected"`
SecondOpinion json.RawMessage `json:"secondOpinion,omitempty"`
}
Analysis is which title is the film and why.
type App ¶
App is what the routes and sources need.
func (*App) Items ¶
func (a *App) Items(req sdui.ItemsRequest) (sdui.ItemsAnswer, error)
Items answers the server's sdui.items call for one of the module's sources.
type Config ¶
Config is which disc module this is.
func (Config) Commands ¶
func (c Config) Commands() []core.CommandSpec
Commands are the module's own commands, as its sdui.json declares them.
type Disc ¶
type Disc struct {
ID int64 `json:"id"`
Kind string `json:"kind"`
Title string `json:"title"`
Label string `json:"label"`
RuntimeSec float64 `json:"runtimeSec"`
Scrambled bool `json:"scrambled"`
Main int `json:"main"`
EngineMain int `json:"engineMain"`
Chosen json.RawMessage `json:"chosen"`
ChosenBy string `json:"chosenBy,omitempty"`
Rank json.RawMessage `json:"rank"`
FeatureSec float64 `json:"featureSec,omitempty"`
RankError string `json:"rankError,omitempty"`
Pending bool `json:"pending"`
NoPlay bool `json:"noPlay"`
Page *Page `json:"page,omitempty"`
PageError string `json:"pageError,omitempty"`
Second json.RawMessage `json:"secondOpinion,omitempty"`
// contains filtered or unexported fields
}
Disc is what the host API says of a disc, for a person (WittyMediaServer host_discs.go).
type Dual ¶
type Dual struct {
Config
Helper wittymodule.Handler
// contains filtered or unexported fields
}
Dual is one process answering as either of the two things a server starts the module's program as:
- a helper with one open disc, as it always was (Helper), started for each disc played or ranked, and never given a network;
- the module's service (module API 5): the server's first call is then service.MethodStart, with where its host API is. It listens on this machine only, with a secret of its own, for the routes the server passes on, and answers the SDUI and lifecycle calls. It reads no disc.
wittymodule/service.Main runs a service only, and answers every other call with "unknown-method", so it can't also be the helper a server asks about one disc: this is that part of it, with the same guard (a WittyModule gap: a service with helper calls of its own).
func (*Dual) App ¶
App is the service's routes and sources, with its database opened the first time it's needed.
type Host ¶
type Host interface {
Do(ctx context.Context, on host.On, method, path string, body, out any) error
}
Host is the host API, as much of it as this needs.
type Labels ¶
type Labels struct {
Titles map[string]string `json:"titles"`
Chapters map[string]map[string]string `json:"chapters"`
}
Labels are names given to a disc's titles and chapters, keyed by title number and chapter number (as strings, for JSON).
type Page ¶
type Page struct {
Main *Title `json:"main"`
Extras []Title `json:"extras"`
Menus []Menu `json:"menus"`
Hidden int `json:"hidden"`
}
Page is a disc's page: the film, the other titles worth watching, the menus to jump into.
type Rank ¶
type Rank struct {
Engine string `json:"engine"`
Main int `json:"main"`
Confidence float64 `json:"confidence"`
Level string `json:"level"`
Why string `json:"why"`
Versions []Version `json:"versions"`
Episodes []Episode `json:"episodes"`
Candidates []Candidate `json:"candidates"`
Decoys int `json:"decoys"`
Hidden int `json:"hidden"`
Repairs []string `json:"repairs"`
RepairCnt int `json:"repairCount"`
Issues []Issue `json:"issues"`
Padded int64 `json:"paddedSectors"`
Second *Second `json:"secondOpinion"`
}
Rank is the parts of a kept ranking the pages show.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the module's database.
type Title ¶
type Title struct {
TTN int `json:"ttn"`
Label string `json:"label"` // the name someone gave it, "" for none
DurationSec float64 `json:"durationSec"`
Chapters []Chapter `json:"chapters"`
Audio []string `json:"audio"`
Subtitles []string `json:"subtitles"`
Angles int `json:"angles"`
Wide bool `json:"wide"`
}
Title is one title (a DVD's) or playlist (a Blu-ray's).