Help us shape the future of Go! Take the 2026 Go Developer Survey

mediabrowser

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package mediabrowser implements profile-driven Jellyfin and Emby probes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestedDelivery

func RequestedDelivery(profile string, offer PlaybackOffer) (string, error)

RequestedDelivery models the documented source-derived VOD behavior for the concrete configurations in deviceprofiles. Unknown clients and missing compatible paths fail closed; server decisions must be verified separately.

Types

type PlaybackOffer

type PlaybackOffer struct {
	ID                   string `json:"Id"`
	Protocol             string `json:"Protocol"`
	Path                 string `json:"Path"`
	IsRemote             bool   `json:"IsRemote"`
	SupportsDirectPlay   bool   `json:"SupportsDirectPlay"`
	SupportsDirectStream bool   `json:"SupportsDirectStream"`
	SupportsTranscoding  bool   `json:"SupportsTranscoding"`
	TranscodingURL       string `json:"TranscodingUrl"`
}

PlaybackOffer contains only the fields used by audited client selection. It describes a requested delivery, not proof of the server's actual encode.

type Probe

type Probe struct {
	Name           string            `json:"name"`
	Method         string            `json:"method"`
	Path           string            `json:"path"`
	Headers        map[string]string `json:"headers"`
	Body           json.RawMessage   `json:"body,omitempty"`
	BodyBase64     string            `json:"body_base64,omitempty"`
	RangeKind      string            `json:"range_kind,omitempty"`
	Binary         bool              `json:"binary,omitempty"`
	FixtureOnly    bool              `json:"fixture_only,omitempty"`
	ExpectedStatus int               `json:"expected_status,omitempty"`
}

type Profile

type Profile struct {
	Source        json.RawMessage    `json:"source"`
	Protocol      string             `json:"protocol"`
	Client        string             `json:"client"`
	Headers       map[string]string  `json:"headers"`
	Flows         map[string][]Probe `json:"flows"`
	ProfileStatus string             `json:"profile_status"`
}

type Protocol

type Protocol struct {
	Dialect string
	// contains filtered or unexported fields
}

func Load

func Load(dialect, dir string) (*Protocol, error)

Load reads profiles from a directory supplied by the caller.

func (*Protocol) Clients

func (p *Protocol) Clients() map[string]conform.Client

func (*Protocol) Compare

func (p *Protocol) Compare(a, b conform.Response) conform.Report

func (*Protocol) CompareRequest

func (p *Protocol) CompareRequest(req conform.Request, reference, target conform.Response) conform.Report

CompareRequest treats the target's extra ETag on direct range streams as informational. Ether uses that validator for correct If-Range resumption.

func (*Protocol) Corpus

func (p *Protocol) Corpus(profile string) []conform.Request

func (*Protocol) Discover

func (p *Protocol) Discover(ctx context.Context, c *http.Client, base, token, profile string, align *conform.DiscoveredIDs) conform.DiscoveredIDs

func (*Protocol) Fetch

func (p *Protocol) Fetch(ctx context.Context, c *http.Client, base, token string, r conform.Request, profile string, vars map[string]string, jsonMode bool) (conform.Response, error)

func (*Protocol) FixtureName

func (p *Protocol) FixtureName(profile string, r conform.Request, jsonMode bool) string

func (*Protocol) Formats

func (p *Protocol) Formats() []bool

func (*Protocol) IgnorePaths

func (p *Protocol) IgnorePaths() []string

func (*Protocol) LoadCapturedBindings

func (p *Protocol) LoadCapturedBindings(dir, profile string) error

LoadCapturedBindings must be called before discovery. The fixture directory is explicitly selected by the harness, never guessed from a working directory. Only successful, complete responses attached to this profile's exact requests contribute evidence. Missing fixtures remain errors, not fallback identities.

func (*Protocol) Observe

func (*Protocol) Observe(request conform.Request, response conform.Response, vars map[string]string)

Observe carries the most recent successful playback negotiation into the subsequent stream and timeline probes for this profile. Failed negotiations clear old IDs so a stale session is never mistaken for the new one.

func (*Protocol) Redact

func (p *Protocol) Redact(r conform.Response) conform.Response

Redact removes credentials and host-specific values before fixture storage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL