pms

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pms decodes documented Plex Media Server JSON envelopes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Directory         []Section  `json:"Directory"`
	Metadata          []Metadata `json:"Metadata"`
	Hub               []Hub      `json:"Hub"`
	MachineIdentifier string     `json:"machineIdentifier"`
	Version           string     `json:"version"`
	Size              int        `json:"size"`
	TotalSize         int        `json:"totalSize"`
	Offset            int        `json:"offset"`
}

Container is MediaContainer as documented by the PMS OpenAPI spec.

func Decode

func Decode(body []byte) (Container, error)

Decode unmarshals a documented PMS JSON MediaContainer envelope.

Parameters:

  • body: Raw PMS JSON bytes.

Returns:

  • container: The decoded MediaContainer.
  • err: Non-nil when body is not valid PMS JSON.

type Hub

type Hub struct {
	Title    string     `json:"title"`
	Type     string     `json:"type"`
	Metadata []Metadata `json:"Metadata"`
}

Hub is a search hub from GET /hubs/search.

type Metadata

type Metadata struct {
	RatingKey            flexString `json:"ratingKey"`
	Key                  string     `json:"key"`
	Title                string     `json:"title"`
	Type                 string     `json:"type"`
	Duration             int64      `json:"duration"`
	ViewOffset           int64      `json:"viewOffset"`
	Thumb                string     `json:"thumb"`
	Year                 int        `json:"year"`
	Index                int        `json:"index"`
	ParentIndex          int        `json:"parentIndex"`
	ParentRatingKey      flexString `json:"parentRatingKey"`
	ParentTitle          string     `json:"parentTitle"`
	GrandparentRatingKey flexString `json:"grandparentRatingKey"`
	GrandparentTitle     string     `json:"grandparentTitle"`
	LibrarySectionID     flexString `json:"librarySectionID"`
	TitleSort            string     `json:"titleSort"`
	AddedAt              int64      `json:"addedAt"`
	Media                []media    `json:"Media"`
	Session              session    `json:"Session"`
}

Metadata is a metadata item from the documented metadata schema.

func (*Metadata) File

func (meta *Metadata) File() string

File returns the first on-disk part path from metadata.

Returns:

  • path: The first non-empty part file, or empty when none exist.

func (*Metadata) HasMetadata

func (meta *Metadata) HasMetadata() bool

HasMetadata reports whether the item has a ratingKey or metadata key.

Returns:

  • ok: True when the item can map onto a MediaItem.

func (*Metadata) ID

func (meta *Metadata) ID() string

ID prefers ratingKey, then the metadata id in key.

Returns:

  • id: The PMS metadata identifier.

type Section

type Section struct {
	Key       string `json:"key"`
	Title     string `json:"title"`
	Type      string `json:"type"`
	Thumb     string `json:"thumb"`
	Composite string `json:"composite"`
	Size      int    `json:"size"`
	LeafCount int    `json:"leafCount"`
}

Section is a library section from GET /library/sections/all.

Jump to

Keyboard shortcuts

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