2 Commits

Author SHA1 Message Date
ae4c418323 A few minor progress bar beep tweaks. 2025-07-15 23:13:40 -04:00
0c116adaf2 Progress bar detection updates. 2025-07-13 11:18:51 -04:00
2 changed files with 35 additions and 3 deletions

View File

@ -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
@ -147,8 +154,16 @@ class command:
curl_match = re.search(
r"(\d+\s+\d+\s+\d+\s+\d+.*?(?:k|M|G)?.*?--:--:--|Speed)", text
)
# Pattern 1e: General transfer progress (size, rate, time patterns)
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:
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 (
@ -183,7 +198,7 @@ class command:
# Pattern 3: Progress bars ([#### ], [====> ], etc.)
# Improved pattern to avoid matching IRC channels like [#channel]
bar_match = re.search(r"\[([#=\-\*]+)([\s\.]*)\]", text)
bar_match = re.search(r"\[([#=\*]+)([\s\.\-]*)\]", text)
if bar_match:
filled = len(bar_match.group(1))
unfilled = len(bar_match.group(2))
@ -350,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

View File

@ -4,6 +4,6 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributors.
version = "2025.07.09"
version = "2025.07.15"
codeName = "testing"
code_name = "testing"