fix percentage
This commit is contained in:
@@ -245,6 +245,8 @@ class SeriesApp:
|
||||
# event-driven progress reporting with the legacy callback API that
|
||||
# the CLI still relies on.
|
||||
def wrapped_callback(progress_info):
|
||||
logger.debug(f"wrapped_callback called with: {progress_info}")
|
||||
|
||||
if self._is_cancelled():
|
||||
raise InterruptedError("Download cancelled by user")
|
||||
|
||||
@@ -267,6 +269,11 @@ class SeriesApp:
|
||||
speed = progress_info.get('speed', 0) # bytes/sec
|
||||
eta = progress_info.get('eta') # seconds
|
||||
|
||||
logger.debug(
|
||||
f"Progress calculation: {downloaded}/{total_bytes} = "
|
||||
f"{progress:.1f}%, speed={speed}, eta={eta}"
|
||||
)
|
||||
|
||||
# Convert to expected format for web API callback
|
||||
# Web API expects: percent, downloaded_mb, total_mb,
|
||||
# speed_mbps, eta_seconds
|
||||
@@ -295,6 +302,7 @@ class SeriesApp:
|
||||
'speed_mbps': None,
|
||||
'eta_seconds': None,
|
||||
}
|
||||
logger.debug(f"Old-style progress: {progress}%")
|
||||
|
||||
# Notify progress via new callback system
|
||||
self._callback_manager.notify_progress(
|
||||
@@ -317,6 +325,7 @@ class SeriesApp:
|
||||
# Call callback with web API format
|
||||
# (dict with detailed progress info)
|
||||
if callback:
|
||||
logger.debug(f"Calling progress callback: {web_progress_dict}")
|
||||
callback(web_progress_dict)
|
||||
|
||||
# Propagate progress into the legacy callback chain so
|
||||
|
||||
Reference in New Issue
Block a user