external

package
v0.0.0-...-706a68b Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package external launches the user's real media tools: a URL/file opener, mpv for viewing, and ffmpeg for muxing downloaded replay tracks. These are the "external viewers" the app uses instead of rendering media in-terminal. A link-handler script configured via the config file overrides the openers (see SetLinkHandler).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available(name string) bool

Available reports whether an executable is on PATH, for pre-flight checks.

func FFmpegMuxCommand

func FFmpegMuxCommand(videoPath, audioPath, outPath string) *exec.Cmd

FFmpegMuxCommand builds an ffmpeg invocation that muxes a separate video and audio track into outPath by stream copy (no re-encode), so it is near-instant. Cosmo replays are demuxed HLS; the hls package downloads each track and this combines them into one playable mp4.

func LinkHandlerSet

func LinkHandlerSet() bool

LinkHandlerSet reports whether a link-handler is configured, for call sites whose default isn't OpenURL (live's in-terminal mpv).

func LocalOrURL

func LocalOrURL(localPath, rawURL string) string

LocalOrURL returns localPath if a file exists there, else rawURL. Call sites pass the path their download flow would have written to, so opening media that is already saved reuses the local copy instead of re-fetching it from the CDN.

func MPVCommand

func MPVCommand(url string) *exec.Cmd

MPVCommand builds an mpv invocation for a video URL. Hand it to tea.ExecProcess so mpv gets the terminal and the TUI restores on exit.

func OpenURL

func OpenURL(target string) error

OpenURL opens a URL or file path in the user's link-handler if one is configured, else the OS default handler (browser, image viewer, etc). It returns quickly; the handler runs detached.

The started process is reaped in the background. Nothing here waits on the handler's exit, but a started child still has to be waited on to release it: openers exit almost immediately after handing the URL off, and an unreaped one stays a zombie for the life of the TUI — one per open/view keypress, in a session that can run for hours.

func SetLinkHandler

func SetLinkHandler(path string)

SetLinkHandler routes subsequent OpenURL calls through the given executable, invoked detached as `handler <url>`. Empty restores the default per-OS opener.

Types

This section is empty.

Jump to

Keyboard shortcuts

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