Documentation
¶
Index ¶
- Variables
- func CheckPathWritable(path string) error
- func DarkenColor(hex string, percent int) string
- func ExtractLastError(stderr string) string
- func FilenameTime(filename string) (time.Time, bool)
- func FormatDuration(ms int64) string
- func FormatHumanTime(rfc3339 string) string
- func GenerateBrandCSS(colorLight, colorDark string) string
- func GracefulSignal(p *os.Process) error
- func HumanTime() string
- func OldestToKeep(days int, now time.Time) time.Time
- func ResolveFFmpegPath(customPath string) string
- func ShutdownSignals() []os.Signal
- func TimeUntilNextHour(t time.Time) time.Duration
- func ValidatePath(field, path string) error
- func WrapError(operation string, err error) error
- type Backoff
Constants ¶
This section is empty.
Variables ¶
var ( // StationNamePattern matches printable characters excluding control characters. StationNamePattern = regexp.MustCompile(`^[^\x00-\x1F\x7F]+$`) // StationColorPattern matches hex color format (#RRGGBB). StationColorPattern = regexp.MustCompile(`^#[0-9A-Fa-f]{6}$`) // EmailPattern validates email address format. EmailPattern = regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`) )
Shared validation patterns used across config and API validation.
Functions ¶
func CheckPathWritable ¶ added in v0.5.0
CheckPathWritable verifies that a directory path exists and is writable.
func DarkenColor ¶ added in v0.4.0
DarkenColor darkens a hex color by a percentage (0-100).
func ExtractLastError ¶ added in v0.1.5
ExtractLastError extracts the last meaningful line from stderr output.
func FilenameTime ¶ added in v0.7.0
FilenameTime extracts a timestamp from a filename. Supports: YYYY-MM-DD_HH-MM-SS, YYYY-MM-DD-HH-MM, YYYY-MM-DD.
func FormatDuration ¶ added in v0.5.0
FormatDuration formats milliseconds as a human-readable duration string. Shows only the two most relevant units:
- < 1 minute: "45s"
- < 1 hour: "12m 34s"
- < 24 hours: "2h 24m"
- >= 24 hours: "1d 3h"
func FormatHumanTime ¶ added in v0.0.8
FormatHumanTime converts an RFC3339 timestamp to human-readable local time format.
func GenerateBrandCSS ¶ added in v0.4.0
GenerateBrandCSS generates CSS custom properties for branding.
func GracefulSignal ¶ added in v0.3.0
GracefulSignal attempts graceful process termination.
func HumanTime ¶ added in v0.0.8
func HumanTime() string
HumanTime returns the current local time in a human-readable format.
func OldestToKeep ¶ added in v0.7.0
OldestToKeep returns the oldest timestamp to retain during cleanup. Files older than this should be deleted.
Uses rolling retention: now - (days * 24 hours).
func ResolveFFmpegPath ¶ added in v0.4.0
ResolveFFmpegPath returns the path to the FFmpeg binary, or empty string if not found.
func ShutdownSignals ¶ added in v0.3.0
ShutdownSignals returns the signals to listen for graceful shutdown.
func TimeUntilNextHour ¶ added in v0.7.0
TimeUntilNextHour returns the duration until the next hour boundary.
func ValidatePath ¶ added in v0.5.0
ValidatePath validates a file path for security.
Types ¶
type Backoff ¶ added in v0.1.0
type Backoff struct {
// contains filtered or unexported fields
}
Backoff provides retry delay calculation with exponential growth.
func NewBackoff ¶ added in v0.1.0
NewBackoff returns a new Backoff with the given initial and maximum delays.