diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-08 09:57:25 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-08 09:57:25 +0300 |
| commit | ef1eefce9a1515a17490d6624ef88f2ef41330e1 (patch) | |
| tree | 42c9b979b04f4b2ca3ec9f778e57233171738f76 /internal/cli/video_runner.go | |
| parent | f486e9c677c72a409df8696104661847354286df (diff) | |
refactor: slim cmd composition root, move story video flow to internal/video
- Add newProcessor() and newProcessorConfig in processor_config.go; newStoryRunner
and storyUltraRealistic in story.go; main.go focuses on runCommand wiring.
- Move gallery prompts, GenerateSelectedVideos, and RunStoryVideos into
internal/video; cli.GenerateSelectedVideos delegates for GUI compatibility.
- Remove t.Parallel from Veo tests that patch newGenaiClient (race with globals).
Made-with: Cursor
Diffstat (limited to 'internal/cli/video_runner.go')
| -rw-r--r-- | internal/cli/video_runner.go | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/internal/cli/video_runner.go b/internal/cli/video_runner.go index aab23ae..021a6bf 100644 --- a/internal/cli/video_runner.go +++ b/internal/cli/video_runner.go @@ -1,47 +1,22 @@ 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). +// into MP4 clips using Google's Veo model. It delegates to the video package +// so GUI and tests can keep using the cli entry point without importing video +// directly. // // apiKey is the Google/Gemini API key passed by the caller. // selectedPaths contains the absolute (or relative) paths of the gallery PNGs -// to animate — typically returned by PromptForGalleryVideos. +// to animate — typically returned by video.PromptForGalleryVideos. // // Each page prints a "Generating…" line before the API call and a "Video saved:" // line with the output path on success. The MP4 is written next to its source // PNG so that gallery images and their videos stay in the same directory. // The function stops and returns on the first error so the caller can log it. func GenerateSelectedVideos(apiKey string, selectedPaths []string) error { - if len(selectedPaths) == 0 { - return nil - } - - gen, err := video.NewVeoGenerator(apiKey) - if err != nil { - return fmt.Errorf("cli: initialising Veo generator: %w", err) - } - - ctx := context.Background() - - for _, imgPath := range selectedPaths { - fmt.Printf("Generating video for: %s\n", imgPath) - - // GenerateVideoFromPath applies an operation-level deadline when ctx has none. - mp4Path, err := gen.GenerateVideoFromPath(ctx, imgPath) - if err != nil { - return fmt.Errorf("cli: generating video for %s: %w", imgPath, err) - } - - fmt.Printf("Video saved: %s\n", mp4Path) - } - - return nil + return video.GenerateSelectedVideos(apiKey, selectedPaths) } |
