From cd45f841932052435a28f669405b23f313d9cf62 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 6 Apr 2026 11:28:48 +0300 Subject: fix: correct video integration after comic generation PromptForGalleryVideos now returns []string paths (from recursive walk) instead of []int page numbers, so GenerateSelectedVideos always has the exact path to each gallery PNG regardless of which comics// subdirectory it lives in. Previously, GenerateSelectedVideos passed "." as galleryPath and called loadGalleryImage with a non-recursive filepath.Glob that could not find PNGs in subdirectories, causing video generation to always fail with "no gallery image found". Additional changes: - Add VeoGenerator.GenerateVideoFromPath that accepts a full image path and writes the MP4 next to the source PNG - Make runStoryVideos non-fatal: video errors print a warning and return nil so comic/PDF/narration outputs are never invalidated by Veo errors - Add filterPathsByPages helper and tests for the new behaviour - Add TestFindGalleryPages_Recursive to cover the comics// layout Co-Authored-By: Claude Sonnet 4.6 --- cmd/totalrecall/main.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/totalrecall/main.go b/cmd/totalrecall/main.go index 2c08497..13fa1bd 100644 --- a/cmd/totalrecall/main.go +++ b/cmd/totalrecall/main.go @@ -194,6 +194,10 @@ func runGUIMode(proc *processor.Processor, flags *cli.Flags) error { // --video flag is true (default), it prompts the user to select gallery pages // for Veo video generation and then generates the selected videos. // Passing --video=false skips the prompt entirely. +// +// Video generation failures are intentionally non-fatal: the comic, PDF, and +// narration are already on disk, so a Veo API error should not invalidate +// those outputs. Errors are printed as warnings and the function returns nil. func runStoryVideos(flags *cli.Flags) error { if !flags.VideoEnabled { return nil @@ -201,12 +205,19 @@ func runStoryVideos(flags *cli.Flags) error { // The story runner writes gallery PNGs into ./comics//, so we search // from "." recursively to find them regardless of the exact slug. - selected, err := cli.PromptForGalleryVideos(".") + // PromptForGalleryVideos returns the actual file paths (not just page numbers) + // so GenerateSelectedVideos can locate them without a second directory search. + selectedPaths, err := cli.PromptForGalleryVideos(".") if err != nil { - return fmt.Errorf("video prompt: %w", err) + fmt.Fprintf(os.Stderr, "Warning: video prompt failed: %v\n", err) + return nil + } + + if err := cli.GenerateSelectedVideos(cli.GetGoogleAPIKey(), selectedPaths); err != nil { + fmt.Fprintf(os.Stderr, "Warning: video generation failed: %v\n", err) } - return cli.GenerateSelectedVideos(cli.GetGoogleAPIKey(), selected, ".") + return nil } // storyUltraRealistic converts the --no-ultra-realistic bool flag into a *bool -- cgit v1.2.3