Documentation
¶
Overview ¶
Package plex is fake-plex: one Plex Media Server over the shared Media Server core, the same server at every Node's front. It copies Plex Media Server 1.43.4.10903 (#71, #101) and 1.43.5.11029 (the recorded runs of 2026-11-14): sections with their Locations, partial and section refreshes with refreshing and scannedAt, the item refresh, items with Media[].Part[].file and their Sidecar streams, the 404 HTML body of a gone item, /status/sessions and /transcode/sessions with videoDecision, and the notification socket. A partial refresh takes forward slashes or backslashes and stores backslashes on Windows. A same-folder rename keeps the ratingKey, a destination-first move carries the play count and collections to a new item, and a source-first refresh with autoEmptyTrash purges the item. A Move's copy-then-delete follows MoveRules. Editions are their own items only under Plex Pass. Every route but /identity answers 401 without a token the server issued, the account's JWT included. It answers JSON whatever the Accept header asks for.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Refreshes records each refresh a front took: partial, section and // item. Refreshes = fake.CaptureSpec{Name: "plex-refreshes", Kind: "plex.refresh"} // Items records each item the server added, changed or removed. Items = fake.CaptureSpec{Name: "plex-items", Kind: "plex.item"} )
var Fake = fake.Spec{ Name: name, New: newServer, Endpoints: func(*node.EndpointsBlock, fake.Address) {}, Online: fake.OnlineSuite("plex"), Cues: []fake.CueSpec{{Name: "plex-play"}, {Name: "plex-stop"}, {Name: "plex-restart"}, {Name: "plex-scan"}}, Captures: []fake.CaptureSpec{Refreshes, Items}, Entered: serverfake.Entered(name), }
Fake is the Plex an Admin picks from plex.tv's resources, at every Node's front. Its address is typed, so Endpoints sets nothing.
var MoveRules = mediaserver.MoveRules{SameSection: true, CrossSection: true, AfterDelete: true}
MoveRules are what Plex 1.43.5.11029 did with a Move's copy-then-delete (recorded run 2026-11-23): a copy in its section joins the item, a copy in another section is a new item with the guid's watch data, and a partial refresh of the vacated folder destroys the item.
var Versions = []string{"1.43.4.10903", "1.43.5.11029"}
Versions are the versions this fake plays.
Functions ¶
Types ¶
type ItemRecord ¶
type ItemRecord struct {
Event string `json:"event"`
RatingKey string `json:"ratingKey"`
Section string `json:"section"`
Files []string `json:"files"`
}
ItemRecord is an Items record's data.
type Play ¶
type Play struct {
Path string `json:"path"`
User string `json:"user"`
Player string `json:"player"`
Product string `json:"product,omitempty"`
Decision link.Decision `json:"decision"`
Hardware bool `json:"hardware,omitempty"`
// Unreported is a client that never sent its timeline, which only
// /transcode/sessions lists.
Unreported bool `json:"unreported,omitempty"`
}
Play is a plex-play cue's arguments: a session on the file at Path, as the server stores it.
type Played ¶
type Played struct {
Session string `json:"session"`
}
Played is a plex-play cue's result.
type Refresh ¶
type Refresh struct {
Section string `json:"section,omitempty"`
Path string `json:"path,omitempty"`
Item string `json:"item,omitempty"`
}
Refresh is a Refreshes record's data. Path is the folder as the server stores it, empty for a section refresh, and Item is set for an item refresh.
type Section ¶
type Section struct {
Key string
Title string
Type string
Folders []string
// Scanned is a section that was scanned with its content before the
// fake started.
Scanned bool
}
Section is one library section. Folders are its Locations, under Root.
type Server ¶
type Server struct {
Name string
Version string
Identifier string
// Tokens are server tokens it accepts beside those fake-plex-tv issues
// for it.
Tokens []string
// Owner is the account owner, whose watch data the token reads.
Owner string
PlexPass bool
// KeepTrash turns autoEmptyTrash off, which is on by default.
KeepTrash bool
// Root is the folder the media dir is, as Plex names it, such as /media
// or C:\Media.
Root string
Sections []Section
}
Server is the one Plex a test or the world plays.