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 in-terminal 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 MPVCommand ¶
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 ¶
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.