zapscript

package
v2.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MIMEZaparooZapScript  = "application/vnd.zaparoo.zapscript"
	WellKnownPath         = "/.well-known/zaparoo"
	HeaderZaparooOS       = "Zaparoo-OS"
	HeaderZaparooArch     = "Zaparoo-Arch"
	HeaderZaparooPlatform = "Zaparoo-Platform"
)
View Source
const ExecuteTimeout = 2 * time.Second

ExecuteTimeout is the maximum duration for execute commands.

Variables

View Source
var (
	ErrArgCount     = errors.New("invalid number of arguments")
	ErrRequiredArgs = errors.New("arguments are required")
	ErrRemoteSource = errors.New("cannot run from remote source")
	ErrFileNotFound = errors.New("file not found")
)
View Source
var AcceptedMimeTypes = []string{
	MIMEZaparooZapScript,
}

Functions

func IsMediaLaunchingCommand added in v2.7.0

func IsMediaLaunchingCommand(cmdName string) bool

IsMediaLaunchingCommand returns true if the command launches media and should be subject to playtime limits. This includes all launch.* commands, most playlist commands (play/next/prev/goto/load/open), and mister.mgl.

func ParseAdvArgs added in v2.8.0

func ParseAdvArgs[T any](pl platforms.Platform, env *platforms.CmdEnv, dest *T) error

ParseAdvArgs parses and validates advanced arguments for a command. Returns an error if parsing or validation fails.

func PreWarmZapLinkHosts added in v2.8.0

func PreWarmZapLinkHosts(db *database.Database, platform string, checkInternet func(int) bool)

PreWarmZapLinkHosts pre-warms the DNS and TLS cache for known zaplink hosts. This is called during startup to reduce latency on first zaplink access. It makes HEAD requests to /.well-known/zaparoo for each supported base URL.

func RunCommand

func RunCommand(
	pl platforms.Platform,
	cfg *config.Instance,
	plsc playlists.PlaylistController,
	token tokens.Token,
	cmd parser.Command,
	totalCmds int,
	currentIndex int,
	db *database.Database,
	st *state.State,
	exprOpts *ExprEnvOptions,
) (platforms.CmdResult, error)

RunCommand parses and runs a single ZapScript command.

Types

type ArgPlaylist

type ArgPlaylist struct {
	ID    string            `json:"id"`
	Name  string            `json:"name"`
	Items []ArgPlaylistItem `json:"items"`
}

type ArgPlaylistItem

type ArgPlaylistItem struct {
	Name      string `json:"name"`
	ZapScript string `json:"zapscript"`
}

type ExprEnvOptions added in v2.8.0

type ExprEnvOptions struct {
	Scanned       *parser.ExprEnvScanned
	Launching     *parser.ExprEnvLaunching
	InHookContext bool // prevents recursive hook execution
}

ExprEnvOptions provides optional context for expression environment.

type WellKnown

type WellKnown struct {
	ZapScript int `json:"zapscript"`
}

Directories

Path Synopsis
Package advargs provides type-safe parsing and validation for ZapScript advanced arguments using struct tags and the go-playground/validator library.
Package advargs provides type-safe parsing and validation for ZapScript advanced arguments using struct tags and the go-playground/validator library.
types
Package types provides type definitions and constants for ZapScript advanced arguments.
Package types provides type definitions and constants for ZapScript advanced arguments.

Jump to

Keyboard shortcuts

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