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

plextv

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package plextv decodes plex.tv XML MediaContainer envelopes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Search(body []byte) ([]Media, []Directory, error)

Search unmarshals a plex.tv search envelope.

Parameters:

  • body: Raw XML bytes.

Returns:

  • videos: Video hits.
  • directories: Directory hits.
  • err: Non-nil when body is not valid plex.tv XML.

Types

type Connection

type Connection struct {
	URI      string `xml:"uri,attr"`
	Address  string `xml:"address,attr"`
	Port     int    `xml:"port,attr"`
	Protocol string `xml:"protocol,attr"`
	Local    int    `xml:"local,attr"`
}

Connection is a plex.tv XML device connection.

type Device

type Device struct {
	Name        string       `xml:"name,attr"`
	Address     string       `xml:"address,attr"`
	Port        int          `xml:"port,attr"`
	AccessToken string       `xml:"accessToken,attr"`
	Connection  []Connection `xml:"Connection"`
}

Device is a plex.tv XML device from /api/resources.

func Devices

func Devices(body []byte) ([]Device, error)

Devices unmarshals a plex.tv device-discovery envelope.

Parameters:

  • body: Raw XML bytes.

Returns:

  • devices: Discovered devices.
  • err: Non-nil when body is not valid plex.tv XML.

type Directory

type Directory struct {
	Key   string `xml:"key,attr"`
	Title string `xml:"title,attr"`
	Type  string `xml:"type,attr"`
}

Directory is a plex.tv XML directory listing entry.

type Media

type Media struct {
	RatingKey string `xml:"ratingKey,attr"`
	Key       string `xml:"key,attr"`
	Title     string `xml:"title,attr"`
	Duration  int64  `xml:"duration,attr"`
	Thumb     string `xml:"thumb,attr"`
	Type      string `xml:"type,attr"`
}

Media is a plex.tv XML media listing entry.

func (Media) ID

func (entry Media) ID() string

ID prefers ratingKey, then the metadata id in key.

Returns:

  • id: The metadata identifier, or empty when the key prefix is missing.

type Session

type Session struct {
	Info       sessionInfo `xml:"Session"`
	RatingKey  string      `xml:"ratingKey,attr"`
	Key        string      `xml:"key,attr"`
	Title      string      `xml:"title,attr"`
	Type       string      `xml:"type,attr"`
	Duration   int64       `xml:"duration,attr"`
	ViewOffset int64       `xml:"viewOffset,attr"`
	Thumb      string      `xml:"thumb,attr"`
}

Session is a plex.tv XML playback session entry.

func Sessions

func Sessions(body []byte) ([]Session, error)

Sessions unmarshals a plex.tv sessions envelope.

Parameters:

  • body: Raw XML bytes.

Returns:

  • sessions: Playback sessions.
  • err: Non-nil when body is not valid plex.tv XML.

func (Session) Media

func (entry Session) Media() Media

Media converts a session entry into a media listing entry.

Returns:

  • media: A Media value with the session identity fields.

func (Session) PlaybackID

func (entry Session) PlaybackID() string

PlaybackID returns the nested session identifier.

Returns:

  • id: The plex.tv session id.

Jump to

Keyboard shortcuts

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