4 Commits

2 changed files with 35 additions and 3 deletions

View File

@ -99,6 +99,13 @@ class command:
"Progress detector checking: '" + text + "'", debug.DebugLevel.INFO "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 # Note: Auto-disable on 100% completion removed to respect user
# settings # settings
@ -147,8 +154,16 @@ class command:
curl_match = re.search( curl_match = re.search(
r"(\d+\s+\d+\s+\d+\s+\d+.*?(?:k|M|G)?.*?--:--:--|Speed)", text 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 # For non-percentage progress, use a single activity beep every 2
# seconds # seconds
if ( if (
@ -183,7 +198,7 @@ class command:
# Pattern 3: Progress bars ([#### ], [====> ], etc.) # Pattern 3: Progress bars ([#### ], [====> ], etc.)
# Improved pattern to avoid matching IRC channels like [#channel] # 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: if bar_match:
filled = len(bar_match.group(1)) filled = len(bar_match.group(1))
unfilled = len(bar_match.group(2)) unfilled = len(bar_match.group(2))
@ -350,5 +365,22 @@ class command:
# If anything fails, assume it's not a prompt to be safe # If anything fails, assume it's not a prompt to be safe
return False 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): def set_callback(self, callback):
pass pass

View File

@ -4,5 +4,5 @@
# Fenrir TTY screen reader # Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributors. # By Chrys, Storm Dragon, and contributors.
version = "2025.07.09" version = "2025.07.16"
code_name = "master" code_name = "master"