plex

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorPinNotAuthorized = "Pin not authorized"
View Source
const LibraryURI = "%s/library/sections"
View Source
const SectionURI = "%s/library/sections/%d/all"
View Source
const ServerInfoURI = "%s/media/providers"
View Source
const StatusURI = "%s/status/sessions"
View Source
const TestURI = "%s/identity"

Variables

This section is empty.

Functions

func GetTokenFromPinRequest

func GetTokenFromPinRequest(p *PinRequest) (string, error)

GetTokenFromPinRequest takes in a PinRequest and checks if it has been authenticated. If it has been authenticated it returns the token. If it has not been authenticated it returns an empty string.

Types

type LibraryMetric

type LibraryMetric struct {
	Name string
	Type string
	Size int
}

type Pin

type Pin struct {
	Id        int       `json:"id"`
	Code      string    `json:"code"`
	Expiry    time.Time `json:"expires_at"`
	Trusted   bool      `json:"trusted"`
	AuthToken string    `json:"auth_token"`
}

type PinRequest

type PinRequest struct {
	Pin `json:"pin"`
}

func GetPinRequest

func GetPinRequest() (*PinRequest, error)

GetPinRequest creates a PinRequest using the Plex API and returns it.

type PlexClient

type PlexClient struct {
	Logger  *log.Entry
	Servers []*Server
	// contains filtered or unexported fields
}

func NewPlexClient

func NewPlexClient(c *config.PlexConfig, l *log.Entry) (*PlexClient, error)

func (*PlexClient) GetServerMetrics

func (c *PlexClient) GetServerMetrics() map[string]ServerMetric

GetServerMetrics fetches all metrics for each server and returns them in a map with the servers' names as keys.

type Server

type Server struct {
	ID       string
	Name     string
	Version  string
	Platform string
	BaseURL  string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c config.PlexServerConfig) (*Server, error)

func (*Server) GetLibrary

func (s *Server) GetLibrary() (*api.LibraryResponse, error)

func (*Server) GetSectionSize

func (s *Server) GetSectionSize(id int) (int, error)

func (*Server) GetServerInfo added in v0.2.3

func (s *Server) GetServerInfo() (*api.ServerInfoResponse, error)

func (*Server) GetSessionCount

func (s *Server) GetSessionCount() (int, error)

type ServerMetric

type ServerMetric struct {
	ID             string
	Name           string
	Version        string
	Platform       string
	ActiveSessions int
	Libraries      []LibraryMetric
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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