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 FFmpegMuxCommand ¶
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 mpv).
func LocalOrURL ¶
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 OpenURL ¶
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.
func StartMPV ¶
StartMPV launches mpv on a video URL or file, detached from the TUI: it gets its own window and session, and the TUI carries on while it plays.
--no-terminal because there is no terminal to give it: its output would land on the TUI's screen and it must not read our keys.
subURL, when non-empty, is loaded as an external subtitle track. mpv streams it itself, so a remote URL needs no download first. --sub-file rather than --sub-files because it takes one path verbatim, where the list form would split a URL on its scheme's colon.
Types ¶
This section is empty.