fix not downloading
This commit is contained in:
@@ -244,10 +244,25 @@ class SeriesApp:
|
||||
# Wrap callback to enforce cancellation checks and bridge the new
|
||||
# event-driven progress reporting with the legacy callback API that
|
||||
# the CLI still relies on.
|
||||
def wrapped_callback(progress: float):
|
||||
def wrapped_callback(progress_info):
|
||||
if self._is_cancelled():
|
||||
raise InterruptedError("Download cancelled by user")
|
||||
|
||||
# yt-dlp passes a dict with progress information
|
||||
# Extract percentage from the dict
|
||||
if isinstance(progress_info, dict):
|
||||
# Calculate percentage based on downloaded/total bytes
|
||||
downloaded = progress_info.get('downloaded_bytes', 0)
|
||||
total = progress_info.get('total_bytes') or progress_info.get('total_bytes_estimate', 0)
|
||||
|
||||
if total > 0:
|
||||
progress = (downloaded / total) * 100
|
||||
else:
|
||||
progress = 0
|
||||
else:
|
||||
# Fallback for old-style float progress
|
||||
progress = float(progress_info)
|
||||
|
||||
# Notify progress via new callback system
|
||||
self._callback_manager.notify_progress(
|
||||
ProgressContext(
|
||||
@@ -284,7 +299,7 @@ class SeriesApp:
|
||||
))
|
||||
|
||||
# Perform download
|
||||
self.loader.download(
|
||||
download_success = self.loader.download(
|
||||
self.directory_to_search,
|
||||
serieFolder,
|
||||
season,
|
||||
@@ -294,6 +309,12 @@ class SeriesApp:
|
||||
wrapped_callback
|
||||
)
|
||||
|
||||
# Check if download was successful
|
||||
if not download_success:
|
||||
raise RuntimeError(
|
||||
f"Download failed for S{season:02d}E{episode:02d}"
|
||||
)
|
||||
|
||||
self._operation_status = OperationStatus.COMPLETED
|
||||
logger.info(
|
||||
"Download completed: %s S%02dE%02d",
|
||||
|
||||
Reference in New Issue
Block a user