plex

package
v0.0.0-...-07490c8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: BSD-3-Clause Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const PlexURL = "https://plex.tv"

Variables

This section is empty.

Functions

func WithCacheLibrary

func WithCacheLibrary(location string) func(*Plex)

func WithLogger

func WithLogger(l *slog.Logger) func(*Plex)

Types

type EventHandler

type EventHandler func(n NotificationContainer)

type NotificationContainer

type NotificationContainer = notification.Container

NotificationContainer is an alias for the internal notification container type.

type NotificationEvents

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

NotificationEvents hold callbacks that correspond to notifications.

func NewNotificationEvents

func NewNotificationEvents() *NotificationEvents

NewNotificationEvents initializes the event callbacks.

func (*NotificationEvents) OnActivity

func (e *NotificationEvents) OnActivity(fn func(n NotificationContainer))

OnActivity handles activity notifications.

func (*NotificationEvents) OnPlaying

func (e *NotificationEvents) OnPlaying(fn func(n NotificationContainer))

OnPlaying shows state information (resume, stop, pause) on a user consuming media in plex.

func (*NotificationEvents) OnTranscodeUpdate

func (e *NotificationEvents) OnTranscodeUpdate(fn func(n NotificationContainer))

OnTranscodeUpdate shows transcode information when a transcoding stream changes parameters.

func (*NotificationEvents) OnUpdateStateChange

func (e *NotificationEvents) OnUpdateStateChange(fn func(n NotificationContainer))

OnUpdateStateChange handles update state change notifications.

type Options

type Options func(*Plex)

type Plex

type Plex struct {
	Libraries library.Libraries

	Websocket *NotificationEvents
	Webhook   *Webhook
	// contains filtered or unexported fields
}

func New

func New(baseURL, token string, options ...Options) (*Plex, error)

func (*Plex) Close

func (p *Plex) Close()

func (*Plex) GetLibraries

func (p *Plex) GetLibraries() (library.Libraries, error)

GetLibraries of your Plex server.

func (*Plex) GetLibraryMovies

func (p *Plex) GetLibraryMovies(lib *library.Library, filter string) error

GetLibraryMovies adds the movies to the Library.

func (*Plex) GetLibraryShows

func (p *Plex) GetLibraryShows(lib *library.Library, filter string) error

GetLibraryShows adds the shows to the Library.

func (*Plex) GetMetadata

func (p *Plex) GetMetadata(ratingKey string) (api.MediaMetadata, error)

func (*Plex) GetSessions

func (p *Plex) GetSessions() (api.CurrentSessions, error)

GetSessions of devices currently consuming media.

func (*Plex) GetShowEpisodes

func (p *Plex) GetShowEpisodes(show *library.Show) error

func (*Plex) InitLibraries

func (p *Plex) InitLibraries() error

func (*Plex) PopulateLibraries

func (p *Plex) PopulateLibraries() func()

func (*Plex) ScanLibrary

func (p *Plex) ScanLibrary(lib *library.Library) error

func (*Plex) Scrobble

func (p *Plex) Scrobble(key string) error

func (*Plex) ServeWebhook

func (p *Plex) ServeWebhook()

func (*Plex) SubscribeToNotifications

func (p *Plex) SubscribeToNotifications()

SubscribeToNotifications connects to your server via websockets listening for events.

func (*Plex) UnScrobble

func (p *Plex) UnScrobble(key string) error

func (*Plex) WriteCache

func (p *Plex) WriteCache()

type Webhook

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

Webhook holds the actions for each webhook events.

func NewWebhook

func NewWebhook(port int, ips ...net.IP) *Webhook

func (*Webhook) OnPause

func (wh *Webhook) OnPause(fn func(w WebhookEvent)) error

OnPause executes when the webhook receives a pause event.

func (*Webhook) OnPlay

func (wh *Webhook) OnPlay(fn func(w WebhookEvent)) error

OnPlay executes when the webhook receives a play event.

func (*Webhook) OnRate

func (wh *Webhook) OnRate(fn func(w WebhookEvent)) error

OnRate executes when the webhook receives a rate event.

func (*Webhook) OnResume

func (wh *Webhook) OnResume(fn func(w WebhookEvent)) error

OnResume executes when the webhook receives a resume event.

func (*Webhook) OnScrobble

func (wh *Webhook) OnScrobble(fn func(w WebhookEvent)) error

OnScrobble executes when the webhook receives a scrobble event.

func (*Webhook) OnStop

func (wh *Webhook) OnStop(fn func(w WebhookEvent)) error

OnStop executes when the webhook receives a stop event.

type WebhookEvent

type WebhookEvent = webhook.Event

WebhookEvent is an alias for the internal webhook event type.

Jump to

Keyboard shortcuts

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