player

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Launcher

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

Launcher launches media URLs in an external player

func NewLauncher

func NewLauncher(command string, args []string, seekFlag string, logger *slog.Logger) *Launcher

NewLauncher creates a new Launcher seekFlag is optional - if empty, we look up the flag from our known players table

func (*Launcher) Launch

func (l *Launcher) Launch(offset time.Duration, playlistStart int, media ...domain.PlayableMedia) (*exec.Cmd, string, error)

Launch opens one or more media URLs in the configured player or auto-detected player.

type PlaybackHandle added in v0.0.2

type PlaybackHandle struct {
	ResultCh <-chan ScrobbleResult
	StatusCh <-chan string
}

PlaybackHandle provides channels for monitoring progress and final result.

type PlayerDef

type PlayerDef struct {
	Binary   string
	SeekFlag string // Use %d for seconds placeholder, e.g., "--start=%d" or "-ss %d"
}

PlayerDef defines a player binary and its seek flag format

type ScrobbleResult added in v0.0.2

type ScrobbleResult struct {
	Item       domain.MediaItem
	ItemID     string
	Title      string
	FinalPosMs int64
	Duration   time.Duration
	AutoMarked bool
	Err        error
}

ScrobbleResult contains the final outcome of a monitored playback session.

type Scrobbler added in v0.0.2

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

Scrobbler monitors a running player process and reports progress to the server.

func NewScrobbler added in v0.0.2

func NewScrobbler(client domain.PlaybackClient, logger *slog.Logger) *Scrobbler

NewScrobbler creates a new scrobbler.

func (*Scrobbler) Monitor added in v0.0.2

func (s *Scrobbler) Monitor(ctx context.Context, cmd *exec.Cmd, ipcSocket string, playlistStart int, items ...domain.MediaItem) PlaybackHandle

Monitor starts a background goroutine to track playback progress for one or more items. If multiple items are provided, it uses mpv IPC to detect which one is active.

type Service

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

Service orchestrates playback operations

func NewService

func NewService(launcher *Launcher, playback domain.PlaybackClient, logger *slog.Logger) *Service

NewService creates a new playback service

func (*Service) MarkUnwatched

func (s *Service) MarkUnwatched(ctx context.Context, itemID string) error

MarkUnwatched marks an item as unwatched

func (*Service) MarkWatched

func (s *Service) MarkWatched(ctx context.Context, itemID string) error

MarkWatched marks an item as fully watched

func (*Service) Play

func (s *Service) Play(ctx context.Context, item domain.MediaItem, playlist ...domain.MediaItem) (PlaybackHandle, error)

Play starts playback of a media item from the beginning

func (*Service) Resume

func (s *Service) Resume(ctx context.Context, item domain.MediaItem, playlist ...domain.MediaItem) (PlaybackHandle, error)

Resume starts playback from the saved position

Jump to

Keyboard shortcuts

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