diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-21 21:43:40 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-21 21:43:40 +0200 |
| commit | 8a4b935792c50101cf65b36e44f376c90c2d08c1 (patch) | |
| tree | 2a8288e935fe89738fbc1243253bb638dc2620a8 /internal/gui/navigation.go | |
| parent | 2bd22f79f739136a7d30cf156979e2f2b23b7c65 (diff) | |
improve: better audio player UI and debugging for bg-bg cards
- Add debug logging to navigation.go to diagnose audio file loading issues
Prints paths being checked and whether files are found
- Improve AudioPlayer UI for Bulgarian-Bulgarian cards:
- Add labels showing 'Front' and 'Back' for bg-bg audio buttons
- Labels only show when audio files are actually loaded
- Better visual distinction between the two playable audios
- Reorganized button layout with VBox for cleaner appearance
- Track bg-bg state in AudioPlayer (isBgBg field)
- Automatically set when back audio file is loaded
- Used to determine when to show labels
This makes it clearer that Bulgarian-Bulgarian cards have two independently
playable audio outputs, and helps debug why audio isn't being loaded.
Diffstat (limited to 'internal/gui/navigation.go')
| -rw-r--r-- | internal/gui/navigation.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/gui/navigation.go b/internal/gui/navigation.go index 4b1f8bf..82176d2 100644 --- a/internal/gui/navigation.go +++ b/internal/gui/navigation.go @@ -429,26 +429,40 @@ func (a *Application) loadExistingFiles(word string) { frontAudio := filepath.Join(wordDir, fmt.Sprintf("audio_front.%s", a.config.AudioFormat)) backAudio := filepath.Join(wordDir, fmt.Sprintf("audio_back.%s", a.config.AudioFormat)) + fmt.Printf("Looking for front audio at: %s\n", frontAudio) + fmt.Printf("Looking for back audio at: %s\n", backAudio) + if _, err := os.Stat(frontAudio); err == nil { + fmt.Printf("Found front audio file: %s\n", frontAudio) a.currentAudioFile = frontAudio fyne.Do(func() { a.audioPlayer.SetAudioFile(frontAudio) }) + } else { + fmt.Printf("Front audio file not found (error: %v)\n", err) } + if _, err := os.Stat(backAudio); err == nil { + fmt.Printf("Found back audio file: %s\n", backAudio) a.currentAudioFileBack = backAudio fyne.Do(func() { a.audioPlayer.SetBackAudioFile(backAudio) }) + } else { + fmt.Printf("Back audio file not found (error: %v)\n", err) } } else { // For en-bg cards, load standard audio file audioFile := filepath.Join(wordDir, fmt.Sprintf("audio.%s", a.config.AudioFormat)) + fmt.Printf("Looking for audio at: %s\n", audioFile) if _, err := os.Stat(audioFile); err == nil { + fmt.Printf("Found audio file: %s\n", audioFile) a.currentAudioFile = audioFile fyne.Do(func() { a.audioPlayer.SetAudioFile(audioFile) }) + } else { + fmt.Printf("Audio file not found (error: %v)\n", err) } // Hide back audio button for en-bg cards a.currentAudioFileBack = "" |
