diff options
Diffstat (limited to 'internal/gui')
| -rw-r--r-- | internal/gui/app.go | 15 | ||||
| -rw-r--r-- | internal/gui/generator.go | 15 |
2 files changed, 25 insertions, 5 deletions
diff --git a/internal/gui/app.go b/internal/gui/app.go index 4e70970..3e256b8 100644 --- a/internal/gui/app.go +++ b/internal/gui/app.go @@ -100,7 +100,8 @@ type Config struct { // DefaultConfig returns default GUI configuration func DefaultConfig() *Config { homeDir, _ := os.UserHomeDir() - outputDir := filepath.Join(homeDir, "Downloads") + // Use XDG Base Directory specification for state data + outputDir := filepath.Join(homeDir, ".local", "state", "totalrecall", "cards") return &Config{ OutputDir: outputDir, @@ -113,6 +114,18 @@ func DefaultConfig() *Config { func New(config *Config) *Application { if config == nil { config = DefaultConfig() + } else { + // Fill in missing fields with defaults + defaults := DefaultConfig() + if config.OutputDir == "" { + config.OutputDir = defaults.OutputDir + } + if config.AudioFormat == "" { + config.AudioFormat = defaults.AudioFormat + } + if config.ImageProvider == "" { + config.ImageProvider = defaults.ImageProvider + } } // Ensure output directory exists diff --git a/internal/gui/generator.go b/internal/gui/generator.go index 316cab8..6cd0fca 100644 --- a/internal/gui/generator.go +++ b/internal/gui/generator.go @@ -115,12 +115,19 @@ func (a *Application) generateAudio(ctx context.Context, word string) (string, e speed = 1.0 } - // Update audio config with selected voice and speed - a.audioConfig.OpenAIVoice = voice - a.audioConfig.OpenAISpeed = speed + // Create a copy of audio config with selected voice and speed + audioConfig := *a.audioConfig + audioConfig.OpenAIVoice = voice + audioConfig.OpenAISpeed = speed + audioConfig.OutputDir = a.config.OutputDir // Ensure correct output directory + + // Log the regeneration details + if isRegeneration { + fmt.Printf("Regenerating audio for '%s' with voice: %s, speed: %.2f\n", word, voice, speed) + } // Create audio provider - provider, err := audio.NewProvider(a.audioConfig) + provider, err := audio.NewProvider(&audioConfig) if err != nil { return "", err } |
