use of websockets
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user