summaryrefslogtreecommitdiff
path: root/internal/gui/generator.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-17 15:35:03 +0300
committerPaul Buetow <paul@buetow.org>2025-07-17 15:35:03 +0300
commitf6477f82dc79d17e9ee3193c81dca2db884a7119 (patch)
tree3424d2342ba976791dc3bb8b108dfdd290018175 /internal/gui/generator.go
parent094447b570c5c5a7c751e0e60279cfa08e945755 (diff)
add phoenetic alphabet
Diffstat (limited to 'internal/gui/generator.go')
-rw-r--r--internal/gui/generator.go13
1 files changed, 8 insertions, 5 deletions
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)