From f6477f82dc79d17e9ee3193c81dca2db884a7119 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 17 Jul 2025 15:35:03 +0300 Subject: add phoenetic alphabet --- internal/gui/generator.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'internal/gui/generator.go') diff --git a/internal/gui/generator.go b/internal/gui/generator.go index 0d30f79..6d51359 100644 --- a/internal/gui/generator.go +++ b/internal/gui/generator.go @@ -120,11 +120,11 @@ func (a *Application) generateAudio(word string) (string, error) { // generateImages downloads images for a word func (a *Application) generateImages(word string) (string, error) { - return a.generateImagesWithPrompt(word, "") + return a.generateImagesWithPrompt(word, "", "") } -// generateImagesWithPrompt downloads a single image for a word with optional custom prompt -func (a *Application) generateImagesWithPrompt(word string, customPrompt string) (string, error) { +// generateImagesWithPrompt downloads a single image for a word with optional custom prompt and translation +func (a *Application) generateImagesWithPrompt(word string, customPrompt string, translation string) (string, error) { // Create image searcher based on provider var searcher image.ImageSearcher var err error @@ -155,17 +155,20 @@ func (a *Application) generateImagesWithPrompt(word string, customPrompt string) OutputDir: a.config.OutputDir, OverwriteExisting: true, CreateDir: true, - FileNamePattern: "{word}_{index}", + FileNamePattern: "{word}", MaxSizeBytes: 5 * 1024 * 1024, // 5MB } downloader := image.NewDownloader(searcher, downloadOpts) - // Create search options with custom prompt if provided + // Create search options with custom prompt and translation if provided searchOpts := image.DefaultSearchOptions(word) if customPrompt != "" { searchOpts.CustomPrompt = customPrompt } + if translation != "" { + searchOpts.Translation = translation + } // Download single image _, path, err := downloader.DownloadBestMatchWithOptions(a.ctx, searchOpts) -- cgit v1.2.3