diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py b/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py index 946dd844..e195d1b7 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/65000-progress_detector.py @@ -99,6 +99,13 @@ class command: "Progress detector checking: '" + text + "'", debug.DebugLevel.INFO ) + # Filter out URLs to prevent false positives + if self.contains_url(text): + self.env["runtime"]["DebugManager"].write_debug_out( + "Skipping progress detection - text contains URL", debug.DebugLevel.INFO + ) + return + # Note: Auto-disable on 100% completion removed to respect user # settings @@ -151,8 +158,12 @@ class command: transfer_match = re.search( r"\d+\s+\d+[kMGT]?\s+\d+\s+\d+[kMGT]?.*?\d+\.\d+[kMGT].*?\d+:\d+:\d+", text ) + # Pattern 1f: Pacman-style transfer progress (flexible size/speed/time) + pacman_match = re.search( + r"\d+(?:\.\d+)?\s+[kKmMgGtT]iB\s+\d+(?:\.\d+)?\s+[kKmMgGtT]iB/s\s+\d+:\d+", text + ) - if time_match or token_match or dd_match or curl_match or transfer_match: + if time_match or token_match or dd_match or curl_match or transfer_match or pacman_match: # For non-percentage progress, use a single activity beep every 2 # seconds if ( @@ -354,5 +365,22 @@ class command: # If anything fails, assume it's not a prompt to be safe return False + def contains_url(self, text): + """Check if text contains URLs that might cause false progress detection""" + import re + + # Common URL patterns that might contain progress-like patterns + url_patterns = [ + r"https?://[^\s]+", # http:// or https:// URLs + r"ftp://[^\s]+", # ftp:// URLs + r"www\.[^\s]+", # www. domains + r"[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}[/\w.-]*", # domain.com/path patterns + ] + + for pattern in url_patterns: + if re.search(pattern, text, re.IGNORECASE): + return True + return False + def set_callback(self, callback): pass diff --git a/src/fenrirscreenreader/fenrirVersion.py b/src/fenrirscreenreader/fenrirVersion.py index 5cb0b9ed..086b56af 100644 --- a/src/fenrirscreenreader/fenrirVersion.py +++ b/src/fenrirscreenreader/fenrirVersion.py @@ -4,6 +4,6 @@ # Fenrir TTY screen reader # By Chrys, Storm Dragon, and contributors. -version = "2025.07.13" +version = "2025.07.15" codeName = "testing" code_name = "testing"