use of websockets

This commit is contained in:
2025-11-01 19:23:32 +01:00
parent 57c30a0156
commit d5f7b1598f
5 changed files with 131 additions and 100 deletions

View File

@@ -251,8 +251,17 @@ class SeriesApp:
raise InterruptedError("Download cancelled by user")
# yt-dlp passes a dict with progress information
# Extract percentage from the dict
# Only process progress updates when status is 'downloading'
# (yt-dlp also sends 'finished', 'error', etc.)
if isinstance(progress_info, dict):
status = progress_info.get('status')
if status and status != 'downloading':
logger.debug(
f"Skipping progress update with status: {status}"
)
return
# Extract percentage from the dict
# Calculate percentage based on downloaded/total bytes
downloaded = progress_info.get('downloaded_bytes', 0)
total_bytes = (
@@ -325,7 +334,9 @@ class SeriesApp:
# Call callback with web API format
# (dict with detailed progress info)
if callback:
logger.debug(f"Calling progress callback: {web_progress_dict}")
logger.debug(
f"Calling progress callback: {web_progress_dict}"
)
try:
callback(web_progress_dict)
logger.debug("Progress callback executed successfully")