Help us shape the future of Go! Take the 2026 Go Developer Survey

spike

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package spike serves a handful of local video files as a Plex library so the Plex front end (internal/plex) can be tested against official Plex apps before the Usenet engine exists. It implements core.Catalog and core.Playback over the files, plus in-memory State, Playlists, Collections, Recommender, Auth and a direct-play-only Transcoder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFileName

func ParseFileName(path string) (string, int)

ParseFileName turns "The.Signal.1999.1080p.BluRay.x264.mkv" into ("The Signal", 1999).

func ParseProbe

func ParseProbe(data []byte, ext string) (core.MediaInfo, error)

ParseProbe converts ffprobe JSON into core.MediaInfo. ext is the file extension, used to tell MP4 from MOV (ffprobe reports both as one format_name).

Types

type Library

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

Library is the spike bundle.

func New

func New(ctx context.Context, cfg func() config.Config, opts Options) (*Library, error)

New builds the library: every configured file is stat'ed and probed (ffprobe when on PATH, otherwise estimated). Missing files are skipped with a warning; it is an error if none remain.

func (*Library) Auth

func (l *Library) Auth() core.Auth

func (*Library) Catalog

func (l *Library) Catalog() core.Catalog

Catalog etc. expose the individual adapters.

func (*Library) Close

func (l *Library) Close() error

Close stops the session janitor and closes open files.

func (*Library) Collections

func (l *Library) Collections() core.Collections

func (*Library) Deps

func (l *Library) Deps() plex.Deps

Deps returns a plex.Deps wired to the spike adapters, a movies-only section and the identity from the config.

func (*Library) OpenPlex added in v0.3.0

func (l *Library) OpenPlex() (*plex.Server, func(), error)

OpenPlex serves this library through the Plex front end and the shared session broker. Timeline progress and stops are recorded only by the broker.

func (*Library) Playback

func (l *Library) Playback() core.Playback

func (*Library) Playlists

func (l *Library) Playlists() core.Playlists

func (*Library) Recommender

func (l *Library) Recommender() core.Recommender

func (*Library) State

func (l *Library) State() core.State

func (*Library) Transcoder

func (l *Library) Transcoder() core.Transcoder

type Options

type Options struct {
	// Files overrides config.Spike.LocalFiles when non-empty.
	Files []string
	// Tokens accepted as the owner, in addition to config.Plex.Token.
	Tokens []string
	// AcceptAnyToken maps every non-empty token to the owner. For LAN
	// testing with real Plex apps (whose per-device plex.tv tokens the spike
	// cannot verify). Never enable on an exposed server.
	AcceptAnyToken bool
	// FFprobePath overrides config.Transcode.FFprobePath / PATH lookup.
	FFprobePath string
	// DisableProbe skips ffprobe and estimates media info (tests).
	DisableProbe bool
	// SessionIdle closes play sessions without activity (default 10 min).
	SessionIdle time.Duration
	Logger      *slog.Logger
}

Options configure the spike library.

Directories

Path Synopsis
cmd
ether-spike command
Command ether-spike serves local video files through Ether's Plex front end, for testing official Plex apps (and pmsdiff) before the Usenet engine is wired in.
Command ether-spike serves local video files through Ether's Plex front end, for testing official Plex apps (and pmsdiff) before the Usenet engine is wired in.

Jump to

Keyboard shortcuts

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