From 27c35939b152221ce19126f4c1e6d875eacdc734 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 7 Jun 2025 11:13:15 -0400 Subject: [PATCH] A few minor tweaks to progressbar beeps. --- .../onScreenUpdate/65000-progress_detector.py | 40 +++++++------------ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py b/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py index ea32fa36..270d3915 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py @@ -60,29 +60,32 @@ class command(): # Debug: Print what we're checking self.env['runtime']['debug'].writeDebugOut("Progress detector checking: '" + text + "'", debug.debugLevel.INFO) - # Check if progress monitoring should automatically stop - self.checkProgressCompletion(text, currentTime) + # Note: Auto-disable on 100% completion removed to respect user settings # Pattern 1: Percentage (50%, 25.5%, etc.) percentMatch = re.search(r'(\d+(?:\.\d+)?)\s*%', text) if percentMatch: percentage = float(percentMatch.group(1)) - self.env['runtime']['debug'].writeDebugOut("Found percentage: " + str(percentage), debug.debugLevel.INFO) - if percentage != self.env['commandBuffer']['lastProgressValue']: - self.env['runtime']['debug'].writeDebugOut("Playing tone for: " + str(percentage), debug.debugLevel.INFO) - self.playProgressTone(percentage) - self.env['commandBuffer']['lastProgressValue'] = percentage - self.env['commandBuffer']['lastProgressTime'] = currentTime - return + # Only trigger on realistic progress percentages (0-100%) + if 0 <= percentage <= 100: + self.env['runtime']['debug'].writeDebugOut("Found percentage: " + str(percentage), debug.debugLevel.INFO) + if percentage != self.env['commandBuffer']['lastProgressValue']: + self.env['runtime']['debug'].writeDebugOut("Playing tone for: " + str(percentage), debug.debugLevel.INFO) + self.playProgressTone(percentage) + self.env['commandBuffer']['lastProgressValue'] = percentage + self.env['commandBuffer']['lastProgressTime'] = currentTime + return # Pattern 1b: Time/token activity (not percentage-based, so use single beep) timeMatch = re.search(r'(\d+)s\s', text) tokenMatch = re.search(r'(\d+)\s+tokens', text) + # Pattern 1c: Curl-style transfer data (bytes, speed indicators) + curlMatch = re.search(r'(\d+\s+\d+\s+\d+\s+\d+.*?(?:k|M|G)?.*?--:--:--|Speed)', text) - if timeMatch or tokenMatch: + if timeMatch or tokenMatch or curlMatch: # For non-percentage progress, use a single activity beep every 2 seconds if currentTime - self.env['commandBuffer']['lastProgressTime'] >= 2.0: - self.env['runtime']['debug'].writeDebugOut("Playing activity beep for Claude Code progress", debug.debugLevel.INFO) + self.env['runtime']['debug'].writeDebugOut("Playing activity beep for transfer progress", debug.debugLevel.INFO) self.playActivityBeep() self.env['commandBuffer']['lastProgressTime'] = currentTime return @@ -148,21 +151,6 @@ class command(): except Exception as e: self.env['runtime']['debug'].writeDebugOut("Sox tone error: " + str(e), debug.debugLevel.ERROR) - def checkProgressCompletion(self, text, currentTime): - """Check if progress is complete and should auto-disable monitoring""" - # Progress monitor is now beep-only - user controls speech separately - # Only auto-disable on clear 100% completion for convenience - import re - - if re.search(r'100\s*%', text): - self.env['runtime']['debug'].writeDebugOut("Progress complete: 100%", debug.debugLevel.INFO) - self.stopProgressMonitoring() - return - - def stopProgressMonitoring(self): - """Stop progress monitoring - beep-only, no speech control""" - self.env['commandBuffer']['progressMonitoring'] = False - # Just disable monitoring, don't touch speech settings def setCallback(self, callback): pass \ No newline at end of file