// Command rtsp-streamer is a full-screen RTSP video wall for UniFi Protect // cameras, driven by mpv under a kiosk Wayland compositor and configured from // the command line or an interactive TUI. package main import ( "fmt" "log/slog" "os" "github.com/lwoodard/rtsp-streamer/internal/config" "github.com/spf13/cobra" ) var ( cfgPath string logLevel string ) func main() { root := &cobra.Command{ Use: "rtsp-streamer", Short: "Full-screen RTSP camera wall for UniFi Protect", SilenceUsage: true, SilenceErrors: true, } root.PersistentFlags().StringVar(&cfgPath, "config", config.DefaultPath(), "path to config file") root.PersistentFlags().StringVar(&logLevel, "log", "info", "log level: debug|info|warn|error") root.AddCommand( daemonCmd(), discoverCmd(), layoutCmd(), statusCmd(), tuiCmd(), configCmd(), ) if err := root.Execute(); err != nil { fmt.Fprintln(os.Stderr, "error:", err) os.Exit(1) } } func newLogger() *slog.Logger { var lvl slog.Level switch logLevel { case "debug": lvl = slog.LevelDebug case "warn": lvl = slog.LevelWarn case "error": lvl = slog.LevelError default: lvl = slog.LevelInfo } return slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: lvl})) }