From 8779de2c97e445acf82e8422c899fdefa4649bda Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 18 Jul 2025 23:18:45 +0300 Subject: feat: multiple improvements to GUI and codebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add random voice speed between 0.90-1.00 for more natural audio - Display voice and speed info in GUI audio player - Implement automatic retry loading for missing files (checks every 2 seconds) - Fix voice/speed info persistence during audio playback - Remove image caching functionality for cleaner codebase - Rename prompt.txt to image_prompt.txt for clarity - Fix GUI to recognize newly added cards during runtime (rescan on navigation) - Update README to reflect removed image cache These changes improve the user experience by making the audio more natural, providing better feedback about audio generation parameters, and ensuring the GUI stays synchronized with externally added cards. πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- internal/gui/app.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'internal/gui/app.go') diff --git a/internal/gui/app.go b/internal/gui/app.go index 28abb7b..da66287 100644 --- a/internal/gui/app.go +++ b/internal/gui/app.go @@ -65,6 +65,7 @@ type Application struct { currentWordIndex int deleteConfirming bool // Track if we're in delete confirmation mode wordChangeTimer *time.Timer // Timer for detecting word changes + fileCheckTicker *time.Ticker // Ticker for checking missing files // Word processing queue queue *WordQueue @@ -88,7 +89,6 @@ type Config struct { OutputDir string AudioFormat string ImageProvider string - EnableCache bool OpenAIKey string } @@ -98,7 +98,6 @@ func DefaultConfig() *Config { OutputDir: "./anki_cards", AudioFormat: "mp3", ImageProvider: "openai", - EnableCache: true, } } @@ -135,7 +134,7 @@ func New(config *Config) *Application { OpenAIVoice: "nova", OpenAISpeed: 0.9, OpenAIInstruction: "You are speaking Bulgarian language (Π±ΡŠΠ»Π³Π°Ρ€ΡΠΊΠΈ Π΅Π·ΠΈΠΊ). Pronounce the Bulgarian text with authentic Bulgarian phonetics, not Russian. Speak slowly and clearly for language learners.", - EnableCache: config.EnableCache, + EnableCache: true, CacheDir: "./.audio_cache", } @@ -371,6 +370,10 @@ func (a *Application) setupUI() { // Add the tooltip layer to enable tooltips a.window.SetContent(fynetooltip.AddWindowToolTipLayer(content, a.window.Canvas())) a.window.SetOnClosed(func() { + // Stop file check ticker + if a.fileCheckTicker != nil { + a.fileCheckTicker.Stop() + } a.cancel() a.queue.Stop() a.wg.Wait() @@ -1080,6 +1083,12 @@ func (a *Application) showError(err error) { } func (a *Application) clearUI() { + // Stop file check ticker when clearing UI + if a.fileCheckTicker != nil { + a.fileCheckTicker.Stop() + a.fileCheckTicker = nil + } + a.imageDisplay.Clear() a.audioPlayer.Clear() // Don't clear the word input or translation entry - they should stay populated -- cgit v1.2.3