session

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: 6 Imported by: 0

Documentation

Overview

Package session monitors live playback sessions on a Plex Media Server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	// GetSessionsOnServer returns the sessions currently playing on server.
	//
	// Parameters:
	//   - ctx: Cancellation and deadline for the fetch.
	//   - server: The Plex Media Server to query.
	//
	// Returns:
	//   - sessions: The active playback sessions.
	//   - err: Non-nil when the server cannot be queried.
	GetSessionsOnServer(ctx context.Context, server plex.Server) ([]plex.Session, error)
}

Fetcher loads live playback sessions from a Plex Media Server.

type Monitor

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

Monitor polls a Plex Media Server for live playback sessions.

func NewMonitor

func NewMonitor(client Fetcher, server plex.Server, interval time.Duration) *Monitor

NewMonitor creates a session monitor that polls client at interval.

The returned monitor is not started. Call Monitor.Start to begin polling.

Parameters:

  • client: Session fetcher, typically a *plex.Client.
  • server: Plex Media Server to poll.
  • interval: Time between session refreshes.

Returns:

  • monitor: A monitor that has not been started.

func (*Monitor) GetSessions

func (mon *Monitor) GetSessions() []plex.Session

GetSessions returns a copy of the cached playback sessions.

Returns:

  • sessions: A clone of the current session list.

func (*Monitor) Start

func (mon *Monitor) Start()

Start begins polling for session updates.

func (*Monitor) Stop

func (mon *Monitor) Stop()

Stop ends polling and waits for the poll goroutine to exit.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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