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

plex

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DecisionPath = "/video/:/transcode/universal/decision"

DecisionPath is the Plex media-decision endpoint official clients call.

Variables

This section is empty.

Functions

func Clients

func Clients() map[string]Client

Clients returns representative Plex Web, iOS and Apple TV request profiles, with the X-Plex-Platform values the real apps send (PMS picks its client profile from them and answers 400 to a decision request from an unknown platform such as "iPhone").

func Compare

func Compare(a, b conform.Response) conform.Report

Compare preserves the Plex-specific response header contract and promotes load-bearing value mismatches (including hub #order) to blocking. Shared Compare leaves KindValue informational so other dialects are not gated on this list.

func QueryPairs

func QueryPairs(raw string) [][2]string

QueryPairs parses a raw query string without reordering.

Types

type Client

type Client = conform.Client

type DecisionCorpus

type DecisionCorpus struct {
	Version int              `json:"version"`
	Policy  string           `json:"policy"`
	Records []DecisionRecord `json:"records"`
}

DecisionCorpus is the offline oracle of official-client decision requests. Query pairs keep wire order. Header pairs keep the recorded client order. Tokens and hosts are redacted before check-in.

func LoadDecisionCorpus

func LoadDecisionCorpus(path string) (DecisionCorpus, error)

LoadDecisionCorpus reads a redacted decision corpus.

func SeedDecisionCorpus

func SeedDecisionCorpus() DecisionCorpus

SeedDecisionCorpus builds the first corpus from the browsing decision probes. Official-client captures replace these headers/query extras.

type DecisionRecord

type DecisionRecord struct {
	ID      string          `json:"id"`
	Client  string          `json:"client"`
	Format  string          `json:"format"`
	Source  string          `json:"source"`
	Request DecisionRequest `json:"request"`
}

DecisionRecord is one redacted decision request plus the fixture it asserts.

func (DecisionRecord) FixturePath

func (r DecisionRecord) FixturePath(root string) string

FixturePath is the recorded PMS response for this decision.

type DecisionRequest

type DecisionRequest struct {
	Method  string      `json:"method"`
	Path    string      `json:"path"`
	Query   [][2]string `json:"query"`
	Headers [][2]string `json:"headers"`
	// Raw is the path+query as recorded on the wire (or the browsing
	// corpus template). Fixture names and Ether replay use this so
	// encoding of {{tokens}} stays byte-identical to the recording.
	Raw string `json:"raw,omitempty"`
}

DecisionRequest is the exact decision the client issued.

func (DecisionRequest) HeaderMap

func (r DecisionRequest) HeaderMap() map[string]string

HeaderMap is the request header set, last value wins for a name.

func (DecisionRequest) Target

func (r DecisionRequest) Target() string

Target is the path+query to replay. Raw wins so fixture names stay stable.

type DiscoveredIDs

type DiscoveredIDs = conform.DiscoveredIDs

func Discover

func Discover(ctx context.Context, client *http.Client, base, token, profile string, align *DiscoveredIDs) DiscoveredIDs

Discover reads sections and representative items on one server. If align is non-nil, matching item GUIDs from that server are preferred; absent matches use the first item.

type Protocol

type Protocol struct{}

Protocol implements the Plex conformance dialect.

func (Protocol) Clients

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

func (Protocol) Compare

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

func (Protocol) Corpus

func (Protocol) Corpus(string) []conform.Request

func (Protocol) Discover

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

func (Protocol) Fetch

func (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 (Protocol) FixtureName(profile string, r conform.Request, jsonMode bool) string

func (Protocol) Formats

func (Protocol) Formats() []bool

func (Protocol) IgnorePaths

func (Protocol) IgnorePaths() []string

func (Protocol) Redact

type Request

type Request = conform.Request

func Corpus

func Corpus() []Request

Corpus returns probes used when a Plex application connects and browses a server.

func PlaybackCorpus

func PlaybackCorpus() []Request

PlaybackCorpus is deliberately separate from the read-only browsing corpus: recording it changes queues and watch state and starts an encoder. Callers must use a disposable reference library and supply queueID/session variables. Tests run these probes offline with deterministic fake playback.

type Response

type Response = conform.Response

func Fetch

func Fetch(ctx context.Context, client *http.Client, base, token string, req Request, profile string, vars map[string]string, jsonMode bool) (Response, error)

Fetch issues a probe, substituting discovered IDs and token, and captures its response.

Jump to

Keyboard shortcuts

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