Documentation
¶
Overview ¶
Package api is Matinee's HTTP API and the host for the web player.
Index ¶
- Constants
- func LiveItem(it store.Item) live.Item
- func RemoteAccessOn(ctx context.Context, s settingStore) (bool, error)
- func RemoteForwardedPort(ctx context.Context, s settingStore) (int, error)
- func ServerUUID(ctx context.Context, db *store.Store) (string, error)
- func TMDBKey(ctx context.Context, st *store.Store, fallback string) (string, error)
- type HomeRow
- type KeywordSource
- type PersonSource
- type Server
- type TMDBKeyHolder
- type TrailerSource
Constants ¶
const ( TMDBKeyFromSettings = "settings" TMDBKeyFromEnvironment = "environment" // MATINEE_TMDB_KEY or --tmdb-key TMDBKeyBuiltIn = "built-in" TMDBKeyNone = "none" )
Where the TMDB key in use comes from (tmdbStatus.Source).
const APIVersion = 1
APIVersion is the version of the documented API served under /api/v1 (openapi.yaml). Changes within a version only add things; anything that would break an app goes in /api/v2.
const SettingHardwareAcceleration = "hardware_acceleration"
SettingHardwareAcceleration holds serverSettings.HardwareAcceleration. The server reads it at startup to set up the transcoder.
const SettingRemoteAccess = "remote_access"
SettingRemoteAccess holds serverSettings.RemoteAccess. The server reads it at startup.
const SettingRemoteForwardedPort = "remote_forwarded_port"
SettingRemoteForwardedPort holds serverSettings.RemoteForwardedPort.
const SettingTMDBKey = "tmdb_api_key"
SettingTMDBKey holds a TMDB key an admin entered in Settings. It wins over MATINEE_TMDB_KEY and a key built into the server; clearing it goes back to those.
Variables ¶
This section is empty.
Functions ¶
func RemoteAccessOn ¶
RemoteAccessOn reads the setting.
func RemoteForwardedPort ¶ added in v0.1.1
RemoteForwardedPort reads the setting: the router port an admin forwarded to the remote access port by hand, or 0.
func ServerUUID ¶ added in v0.1.1
ServerUUID is this server's own id, made up the first time it runs. It stays the same when the server is renamed or moves.
Types ¶
type HomeRow ¶
type HomeRow struct {
ID string `json:"id"` // e.g. "genre:Science Fiction"
Title string `json:"title"`
Genre string `json:"genre"`
// CollectionID is set on the rows of collections pinned to Home.
CollectionID string `json:"collectionId,omitempty"`
// Starter is set on a built-in collection's row (see store.starters).
Starter string `json:"starter,omitempty"`
// Holiday is set on the row for a holiday coming up, e.g. "halloween"
// (see holidays.go).
Holiday string `json:"holiday,omitempty"`
// RelatedTo is the title a related:{id} row is like, so apps can word
// "More like …" in their own language.
RelatedTo string `json:"relatedTo,omitempty"`
Items []store.Item `json:"items"`
// More says the row has more titles than it shows: GET /rows/{id} has
// them all (see rows.go).
More bool `json:"more,omitempty"`
}
HomeRow is one of the home screen's rows: a holiday's, a pinned collection or a genre.
type KeywordSource ¶ added in v0.1.1
KeywordSource finds TMDB's keywords by name. *metadata.TMDB is one.
type PersonSource ¶
PersonSource looks up people's biographies; metadata.TMDB is one.
type Server ¶
type Server struct {
Store *store.Store
Scanner *scan.Scanner
Watcher *scan.Watcher // nil means libraries aren't watched for changes
// ScanInterval is how often every library is rescanned; 0 means never.
ScanInterval time.Duration
Transcoder *stream.Transcoder
HW *hwaccel.Manager // hardware transcoding; nil means the CPU only
Downloads *download.Manager
Analyzer *analyze.Analyzer // nil when media analysis is off for this server
Art *artwork.Cache
Subtitles *subtitle.Converter
Web fs.FS // built web player; nil serves a placeholder
Log *slog.Logger
MediaRoot string // where the folder picker starts; empty means /
Name string // what the apps call this server
// UUID names this server for good, whatever its name or address (see
// ServerUUID); Home Assistant tells servers apart by it.
UUID string
// TrailerSource lists trailers online; nil, or TMDB without a key,
// offers none.
TrailerSource TrailerSource
// Keywords finds TMDB keywords for holiday rows; nil (or no TMDB key)
// matches on words alone.
Keywords KeywordSource
// People has biographies; nil (or no TMDB key) shows only names and photos.
People PersonSource
// TMDB is the client whose key admins can change in Settings (see
// tmdbkey.go); nil means it can't be changed here. TMDBFallback is the
// key it goes back to when the one in Settings is cleared, and
// TMDBFallbackSource where that one comes from (environment or built-in).
TMDB TMDBKeyHolder
TMDBFallback string
TMDBFallbackSource string
// OnTMDBKey runs after an admin changes the TMDB key.
OnTMDBKey func()
// ThemeDir holds the admin's own theme files (see themes.go); empty means
// only the built-in themes.
ThemeDir string
// Remote keeps remote access going (see remote.go); nil when this
// server doesn't offer it.
Remote *remote.Manager
// PublicURL is the address set with MATINEE_PUBLIC_URL, if any.
PublicURL string
// LookupHost resolves PublicURL's host; nil uses the system resolver.
LookupHost func(ctx context.Context, host string) ([]string, error)
// HomeListener means the home network has its own listener (HomeHandler),
// so requests to the main one never count as coming from home.
HomeListener bool
// Translate looks up translations for every library, when people start
// using a language; nil without an online provider that has them.
Translate func(context.Context)
// Plugins are the installed plugins (see plugins.go); nil means this
// server doesn't run them. PluginCatalog lists the official ones; empty
// for none.
Plugins *plugin.Manager
PluginCatalog string
// Live keeps track of open players and runs the event feed (see
// live.go); nil makes one.
Live *live.Hub
// BackgroundCtx scopes scans started by API calls; it outlives any one request.
BackgroundCtx context.Context
// contains filtered or unexported fields
}
func (*Server) BurnStream ¶
BurnStream finds the embedded stream of a picture subtitle track, for the download converter.
func (*Server) HomeHandler ¶
HomeHandler serves the same API as Handler, on the listener meant for the home network.
func (*Server) RemoteHandler ¶
RemoteHandler serves the same API as Handler, on the remote access port. Nothing that arrives there counts as coming from home.