Fix automatic wishlist addition for failed/cancelled tracks in download modal

Issue: Tracks marked as failed or cancelled in the download missing tracks modal
were not being automatically added to the wishlist on completion, despite manual
"Add to Wishlist" button working correctly. Modal completed silently without
mentioning wishlist.

Root cause: Line 549 in web_server.py was calling _on_download_completed() with
wrong parameters - missing batch_id. This caused the completion handler to look
up wrong batch, return early, and never process failed tracks to wishlist.

The bug affected downloads that complete via monitor detection (YouTube, Soulseek)
since the monitor loop calls this function when it detects completed transfers.

Fix: Added missing batch_id parameter to _on_download_completed() call on line 549.

Changed:
  _on_download_completed(task_id, success=True)
To:
  _on_download_completed(batch_id, task_id, success=True)

Tested: Automatic wishlist addition now works correctly for failed/cancelled tracks.
This commit is contained in:
Broque Thomas 2026-01-26 15:35:42 -08:00
parent 9af0be1300
commit c728309a09

View file

@ -546,7 +546,7 @@ class WebUIDownloadMonitor:
# 'Completed' is used by YouTubeClient, 'Succeeded' by Soulseek
if state in ['Completed', 'Succeeded'] and task['status'] == 'downloading':
print(f"✅ Monitor detected completed download for {task_id} ({state}) - triggering post-processing")
_on_download_completed(task_id, success=True)
_on_download_completed(batch_id, task_id, success=True)
# ENHANCED: Add worker count validation to detect ghost workers
self._validate_worker_counts()