diff options
Diffstat (limited to 'internal/gui/generator.go')
| -rw-r--r-- | internal/gui/generator.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/gui/generator.go b/internal/gui/generator.go index a3a0a4d..4569191 100644 --- a/internal/gui/generator.go +++ b/internal/gui/generator.go @@ -154,7 +154,10 @@ func (a *Application) generateAudio(ctx context.Context, word string, cardDir st // generateAudioFront generates front audio for a bg-bg card func (a *Application) generateAudioFront(ctx context.Context, word string, cardDir string) (string, error) { + fmt.Printf("DEBUG (generateAudioFront): Called with word: %s, cardDir: %s\n", word, cardDir) + if cardDir == "" { + fmt.Printf("DEBUG (generateAudioFront): Card directory not provided, returning error\n") return "", fmt.Errorf("card directory not provided") } @@ -170,14 +173,18 @@ func (a *Application) generateAudioFront(ctx context.Context, word string, cardD provider, err := audio.NewProvider(&audioConfig) if err != nil { + fmt.Printf("DEBUG (generateAudioFront): Failed to create audio provider: %v\n", err) return "", err } + fmt.Printf("DEBUG (generateAudioFront): Generating front audio for '%s' with voice: %s, speed: %.2f\n", word, voice, speed) fmt.Printf("Generating front audio for '%s' with voice: %s, speed: %.2f\n", word, voice, speed) frontFile := filepath.Join(cardDir, fmt.Sprintf("audio_front.%s", a.config.AudioFormat)) + fmt.Printf("DEBUG (generateAudioFront): Will write to: %s\n", frontFile) if err := provider.GenerateAudio(ctx, word, frontFile); err != nil { return "", fmt.Errorf("failed to generate front audio: %w", err) } + fmt.Printf("DEBUG (generateAudioFront): Successfully wrote front audio to: %s\n", frontFile) // Update metadata metadataFile := filepath.Join(cardDir, "audio_metadata.txt") @@ -191,7 +198,10 @@ func (a *Application) generateAudioFront(ctx context.Context, word string, cardD // generateAudioBack generates back audio for a bg-bg card func (a *Application) generateAudioBack(ctx context.Context, text string, cardDir string) (string, error) { + fmt.Printf("DEBUG (generateAudioBack): Called with text: %s, cardDir: %s\n", text, cardDir) + if cardDir == "" { + fmt.Printf("DEBUG (generateAudioBack): Card directory not provided, returning error\n") return "", fmt.Errorf("card directory not provided") } @@ -207,14 +217,18 @@ func (a *Application) generateAudioBack(ctx context.Context, text string, cardDi provider, err := audio.NewProvider(&audioConfig) if err != nil { + fmt.Printf("DEBUG (generateAudioBack): Failed to create audio provider: %v\n", err) return "", err } + fmt.Printf("DEBUG (generateAudioBack): Generating back audio for '%s' with voice: %s, speed: %.2f\n", text, voice, speed) fmt.Printf("Generating back audio for '%s' with voice: %s, speed: %.2f\n", text, voice, speed) backFile := filepath.Join(cardDir, fmt.Sprintf("audio_back.%s", a.config.AudioFormat)) + fmt.Printf("DEBUG (generateAudioBack): Will write to: %s\n", backFile) if err := provider.GenerateAudio(ctx, text, backFile); err != nil { return "", fmt.Errorf("failed to generate back audio: %w", err) } + fmt.Printf("DEBUG (generateAudioBack): Successfully wrote back audio to: %s\n", backFile) return backFile, nil } |
