Skip to content

Commit a4afaac

Browse files
Brandon Salzbergclaude
andcommitted
Rename live to footage with optional --start for past footage
- `rhombus footage <camera>` — opens live view (default) - `rhombus footage <camera> --start "1h ago"` — opens past footage - Supports relative times: 5m ago, 1h ago, 2d ago, or epoch ms Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c8bde04 commit a4afaac

3 files changed

Lines changed: 32 additions & 11 deletions

File tree

alert_DI6JrjqwTcuWnSPFUjR3sA.jpeg

15.3 KB
Loading

cmd/live.go renamed to cmd/footage.go

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,22 @@ import (
1919
)
2020

2121
func init() {
22-
liveCmd := &cobra.Command{
23-
Use: "live [camera-name-or-uuid]",
24-
Short: "Open a live video stream in the browser",
25-
Long: "Opens a live video feed from a Rhombus camera in your default browser. Accepts a camera UUID or partial name for fuzzy matching.",
22+
footageCmd := &cobra.Command{
23+
Use: "footage [camera-name-or-uuid]",
24+
Short: "View camera footage in the browser",
25+
Long: "Opens a Rhombus camera player in the browser. Defaults to live view. Use --start to jump to a specific time in the past.",
2626
Args: cobra.ExactArgs(1),
27-
RunE: runLive,
27+
RunE: runFootage,
2828
}
29-
liveCmd.Flags().Int("duration", 3600, "Federated token duration in seconds")
30-
rootCmd.AddCommand(liveCmd)
29+
footageCmd.Flags().String("start", "", "Start time (epoch ms, or relative like '5m ago', '1h ago'). Defaults to live.")
30+
footageCmd.Flags().Int("token-duration", 3600, "Federated token duration in seconds")
31+
rootCmd.AddCommand(footageCmd)
3132
}
3233

33-
func runLive(cmd *cobra.Command, args []string) error {
34+
func runFootage(cmd *cobra.Command, args []string) error {
3435
cfg := config.LoadFromCmd(cmd)
35-
duration, _ := cmd.Flags().GetInt("duration")
36+
duration, _ := cmd.Flags().GetInt("token-duration")
37+
startStr, _ := cmd.Flags().GetString("start")
3638
cameraArg := args[0]
3739

3840
// Resolve camera UUID
@@ -41,17 +43,32 @@ func runLive(cmd *cobra.Command, args []string) error {
4143
return err
4244
}
4345

44-
fmt.Printf("Opening live stream for %s...\n", cameraName)
46+
if startStr != "" {
47+
startMs, err := parseTimestamp(startStr)
48+
if err != nil {
49+
return fmt.Errorf("invalid start time: %w", err)
50+
}
51+
fmt.Printf("Opening footage for %s at %s...\n", cameraName,
52+
time.UnixMilli(startMs).Format("Jan 2 3:04:05 PM"))
53+
} else {
54+
fmt.Printf("Opening live view for %s...\n", cameraName)
55+
}
4556

4657
// Start the local server first so we know the port
4758
serverURL, _, err := startPlayerServer(cameraUUID, cameraName, cfg, duration)
4859
if err != nil {
4960
return fmt.Errorf("starting player server: %w", err)
5061
}
5162

63+
// Append start time if specified
64+
if startStr != "" {
65+
startMs, _ := parseTimestamp(startStr)
66+
serverURL += fmt.Sprintf("&start=%d", startMs)
67+
}
68+
5269
openInBrowserNewWindow(serverURL)
5370

54-
fmt.Printf("Live stream opened in browser.\n")
71+
fmt.Println("Player opened in browser.")
5572
fmt.Println("Press Ctrl+C to stop.")
5673

5774
// Keep the process alive so the local HTTP server stays running

test-results/.last-run.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"status": "failed",
3+
"failedTests": []
4+
}

0 commit comments

Comments
 (0)