plex

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(serverURL, token string) (*Client, error)

New creates a new Plex client

func NewWithName

func NewWithName(serverURL, token, serverName string) (*Client, error)

NewWithName creates a new Plex client with a server name

func (*Client) GetAllMedia

func (c *Client) GetAllMedia(ctx context.Context, progressCallback ProgressCallback) ([]MediaItem, error)

GetAllMedia returns all media items from all libraries

func (*Client) GetLibraries

func (c *Client) GetLibraries(ctx context.Context) ([]Library, error)

GetLibraries returns all library sections using direct HTTP to avoid unmarshaling issues

func (*Client) GetMediaFromSection

func (c *Client) GetMediaFromSection(ctx context.Context, sectionKey, sectionType string) ([]MediaItem, error)

GetMediaFromSection returns media items from a specific library section

func (*Client) GetStreamURL

func (c *Client) GetStreamURL(mediaKey string) (string, error)

GetStreamURL returns the direct stream URL for a media item This gets the actual file URL that can be streamed by MPV

func (*Client) Test

func (c *Client) Test() error

Test validates the connection to the Plex server

type Library

type Library struct {
	Key   string
	Title string
	Type  string
}

Library represents a Plex library section

type MediaItem

type MediaItem struct {
	Key         string
	Title       string
	Year        int
	Type        string // movie, show, season, episode
	Summary     string
	Rating      float64
	Duration    int
	FilePath    string
	RclonePath  string
	ParentTitle string // For episodes: show name
	GrandTitle  string // For episodes: season name
	Index       int64  // Episode or season number
	ParentIndex int64  // Season number for episodes
	Thumb       string // Poster/thumbnail URL path
	ServerName  string // Name of the Plex server this item belongs to
	ServerURL   string // URL of the Plex server this item belongs to
}

func GetAllMediaFromServers

func GetAllMediaFromServers(ctx context.Context, serverConfigs []struct{ Name, URL, Token string }, progressCallback ServerProgressCallback) ([]MediaItem, error)

GetAllMediaFromServers returns all media items from multiple Plex servers

func (*MediaItem) FormatMediaTitle

func (m *MediaItem) FormatMediaTitle() string

FormatMediaTitle returns a formatted title for display

type ProgressCallback

type ProgressCallback func(libraryName string, itemCount int, totalLibraries int, currentLibrary int)

ProgressCallback is called during media fetching to report progress

type Server

type Server struct {
	Name        string
	URL         string
	Local       bool
	Owned       bool
	Connections []string
}

Server represents a Plex server

func Authenticate

func Authenticate(username, password string) (string, []Server, error)

Authenticate authenticates with Plex using username and password Returns auth token and list of available servers

type ServerProgressCallback

type ServerProgressCallback func(serverName, libraryName string, itemCount int, totalLibraries int, currentLibrary int, serverNum int, totalServers int)

ServerProgressCallback is called during multi-server media fetching

Jump to

Keyboard shortcuts

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