summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-06 11:22:35 +0300
committerPaul Buetow <paul@buetow.org>2026-04-06 11:22:35 +0300
commit8f906ac9efc703db4f15c39115394ca8cf01c119 (patch)
tree4a2d0bd56778f5568741af1981cd855b2927222e /internal
parent5c76593737c3b707967bf2ac2394c22630323928 (diff)
feat: add generateSelectedVideos CLI runner for Veo video generation
Implements the shared CLI runner that calls video.VeoGenerator for each selected gallery page number sequentially, printing progress and the saved MP4 path per page. Lives in internal/cli/video_runner.go. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/cli/video_runner.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/internal/cli/video_runner.go b/internal/cli/video_runner.go
new file mode 100644
index 0000000..40a1fdd
--- /dev/null
+++ b/internal/cli/video_runner.go
@@ -0,0 +1,46 @@
+package cli
+
+import (
+ "context"
+ "fmt"
+
+ "codeberg.org/snonux/totalrecall/internal/video"
+)
+
+// generateSelectedVideos is the CLI runner that animates gallery PNG files
+// into MP4 clips using Google's Veo model. It processes pages sequentially
+// (Veo generation is slow and API quotas make parallelism impractical).
+//
+// apiKey is the Google/Gemini API key passed by the caller.
+// selected is the list of gallery page numbers to process (from promptForGalleryVideos).
+// outputDir is both the directory that contains the gallery PNGs and the
+// destination for the resulting MP4 files (written next to the PNGs).
+//
+// Each page prints a "Generating…" line before the API call and a "Video saved:"
+// line with the output path on success. The function stops and returns on the
+// first error so callers can log it without silently skipping pages.
+func generateSelectedVideos(apiKey string, selected []int, outputDir string) error {
+ if len(selected) == 0 {
+ return nil
+ }
+
+ gen, err := video.NewVeoGenerator(apiKey)
+ if err != nil {
+ return fmt.Errorf("cli: initialising Veo generator: %w", err)
+ }
+
+ ctx := context.Background()
+
+ for _, pageNum := range selected {
+ fmt.Printf("Generating video for gallery page %d...\n", pageNum)
+
+ mp4Path, err := gen.GenerateVideoFromGallery(ctx, outputDir, outputDir, pageNum)
+ if err != nil {
+ return fmt.Errorf("cli: generating video for page %d: %w", pageNum, err)
+ }
+
+ fmt.Printf("Video saved: %s\n", mp4Path)
+ }
+
+ return nil
+}