This commit is contained in:
Broque Thomas 2025-07-11 19:15:17 -07:00
parent 6ab0f3550e
commit 3eb7dc8fda
5 changed files with 1410 additions and 11 deletions

View file

@ -1 +1 @@
{"access_token": "BQC2H3Gtur2UVBolbGlrlVtwEq7r-0GaGWTmBQZERyH-UVWKOOu8g2nDf-pKwL7w2yf5j9uolii2YBXpEoCOZyaa2rVbLbzbERDfw__hJ9JDhxwWT7OuIf3gxxCPkZs9d7UEaonxyPY7B8bLh49_uhvYpq7azOAJE40bPknaHR230KGsLQpqQbdo4In07iCLaD-PFGYHC4Me7c0QRvyTC1-gx9qgfvlDF-BvIEHsBpDW6dibzSO0AQjzaR4-Okb-", "token_type": "Bearer", "expires_in": 3600, "scope": "user-library-read user-read-private playlist-read-private playlist-read-collaborative user-read-email", "expires_at": 1752286148, "refresh_token": "AQDmfQkPCGObfJeTUIbW1hAAwhSqkuHRA3Qh2dqVYMRh0eCkFMQgPNJDDzF8y-BiaVbj80zePkK_XSfYH1aJutMtNbnsqRKWuxP31BTrMc7pdUdbE7Fma4oH8wpDUKdG3MM"} {"access_token": "BQBLSLPESDPqAZT7HXU_WwksU6Wjz1fHsiSr43EiG7xD2dHnKJZ4yEaXlxj7cN8BrneCT4aQrfSxEUJMQNPh8kpS2WHaMWTBnmkyk3FVDjhLXOf4vOF893-4xB0yYh2aDJTGnS5dZlqS2Lkvq9CDzTDsIVel8iNXaTnyne90Nb71OtNNjz1_QcpwVEfESFuYBuGI1plfrRguJ_QDl9_Fuejxz79q1jqmONUPYyBBL_aHPpyLiLn7nC0w6gbhqsZi", "token_type": "Bearer", "expires_in": 3600, "scope": "user-library-read user-read-private playlist-read-private playlist-read-collaborative user-read-email", "expires_at": 1752289745, "refresh_token": "AQDmfQkPCGObfJeTUIbW1hAAwhSqkuHRA3Qh2dqVYMRh0eCkFMQgPNJDDzF8y-BiaVbj80zePkK_XSfYH1aJutMtNbnsqRKWuxP31BTrMc7pdUdbE7Fma4oH8wpDUKdG3MM"}

File diff suppressed because it is too large Load diff

View file

@ -2680,12 +2680,14 @@ class DownloadQueue(QFrame):
self.update_queue_count() self.update_queue_count()
def clear_completed_downloads(self): def clear_completed_downloads(self):
"""Remove all completed download items""" """Remove all completed and cancelled download items"""
items_to_remove = [] items_to_remove = []
for item in self.download_items: for item in self.download_items:
# Check for various completed status formats # Check for various completed and cancelled status formats
if (item.status.lower() in ["completed", "finished"] or if (item.status.lower() in ["completed", "finished", "cancelled", "canceled", "failed"] or
item.status.lower().startswith("completed")): item.status.lower().startswith("completed") or
item.status.lower().startswith("cancelled") or
item.status.lower().startswith("canceled")):
items_to_remove.append(item) items_to_remove.append(item)
for item in items_to_remove: for item in items_to_remove:
@ -2801,13 +2803,15 @@ class TabbedDownloadManager(QTabWidget):
self.parent().update_download_manager_stats(active_count, finished_count) self.parent().update_download_manager_stats(active_count, finished_count)
def clear_completed_downloads(self): def clear_completed_downloads(self):
"""Clear completed downloads from both slskd backend and local queues""" """Clear completed and cancelled downloads from both slskd backend and local queues"""
# Delegate to parent (DownloadsPage) which has access to soulseek_client # Delegate to parent (DownloadsPage) which has access to soulseek_client
if hasattr(self.parent(), 'clear_completed_downloads'): if hasattr(self.parent(), 'clear_completed_downloads'):
self.parent().clear_completed_downloads() self.parent().clear_completed_downloads()
else: else:
# Fallback to local clearing if parent method not available # Fallback to local clearing if parent method not available
print("[DEBUG] No parent clear method found, clearing locally only") print("[DEBUG] No parent clear method found, clearing locally only")
# Clear from both active and finished queues
self.active_queue.clear_completed_downloads()
self.finished_queue.clear_completed_downloads() self.finished_queue.clear_completed_downloads()
self.update_tab_counts() self.update_tab_counts()
@ -4457,7 +4461,7 @@ class DownloadsPage(QWidget):
print(f"Error cleaning up finished download thread: {e}") print(f"Error cleaning up finished download thread: {e}")
def clear_completed_downloads(self): def clear_completed_downloads(self):
"""Clear completed downloads from both slskd backend and local queue""" """Clear completed and cancelled downloads from both slskd backend and local queues"""
if not self.soulseek_client: if not self.soulseek_client:
print("[ERROR] No soulseek client available for clearing downloads") print("[ERROR] No soulseek client available for clearing downloads")
return return
@ -4472,17 +4476,17 @@ class DownloadsPage(QWidget):
loop = asyncio.new_event_loop() loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
print("[DEBUG] 🗑️ Clearing all completed downloads from slskd backend...") print("[DEBUG] 🗑️ Clearing all completed/cancelled downloads from slskd backend...")
success = loop.run_until_complete(self.soulseek_client.clear_all_completed_downloads()) success = loop.run_until_complete(self.soulseek_client.clear_all_completed_downloads())
if success: if success:
print("[DEBUG] ✅ Successfully cleared completed downloads from backend") print("[DEBUG] ✅ Successfully cleared completed/cancelled downloads from backend")
# Also clear from local UI # Also clear from local UI (both active and finished queues)
self.download_queue.clear_completed_downloads() self.download_queue.clear_completed_downloads()
# Trigger immediate status update to refresh UI # Trigger immediate status update to refresh UI
self.update_download_status() self.update_download_status()
else: else:
print("[ERROR] ❌ Failed to clear completed downloads from backend") print("[ERROR] ❌ Failed to clear completed/cancelled downloads from backend")
except Exception as e: except Exception as e:
print(f"[ERROR] Exception during clear completed downloads: {e}") print(f"[ERROR] Exception during clear completed downloads: {e}")