good
This commit is contained in:
parent
3920d7a1c6
commit
22700c5567
4 changed files with 18619 additions and 16 deletions
|
|
@ -1 +1 @@
|
||||||
{"access_token": "BQA5kusm3wT-O4gvbF1tQA8jM0VZuA8joZHW3jBVJVsu8HFwtNZ2BxH3vDuXAtp_W2-M4v71rfRU9Uy7LYMIPPoo-vPddXtmNpiPDwvO4cETXsKnIRzV3vlQyGkMP9J4UQ2E7Z-McaPPtuoKyC7C_rRgzdoAD8IGPHSYdR4ABu3thOmAP_MyEtO2P6W8WArtjXHNRFL4h1UUejx2fQbyMgz56YMiWF2VxfQMS7W1-8Fyq7Yz--cA18E8v3FD_15x", "token_type": "Bearer", "expires_in": 3600, "scope": "user-library-read user-read-private playlist-read-private playlist-read-collaborative user-read-email", "expires_at": 1753302850, "refresh_token": "AQDmfQkPCGObfJeTUIbW1hAAwhSqkuHRA3Qh2dqVYMRh0eCkFMQgPNJDDzF8y-BiaVbj80zePkK_XSfYH1aJutMtNbnsqRKWuxP31BTrMc7pdUdbE7Fma4oH8wpDUKdG3MM"}
|
{"access_token": "BQDyX__K5sWHsF6jYB5zydUqscBrufIzZsjJHavHoHHXe8eV7eSnzqyixye5cGcfemMepQbVmT-RVZd8ke6LQI9nwVFOWsXmmUFjLKFuzI6VR5g5tlElhTT-biuIkfIu9iIYcDbqdB60F-PqAbLzef5U99VV60A0roEuVfYKq4LWdhZhWyX8mBC1YOuFVe_hUsb8LFyYQFhrpHeJx_AQiYrbOTUSCrKGnR_i9c-JWRbswz-imQ7kNFCG8UMNnEYq", "token_type": "Bearer", "expires_in": 3600, "scope": "user-library-read user-read-private playlist-read-private playlist-read-collaborative user-read-email", "expires_at": 1753307102, "refresh_token": "AQDmfQkPCGObfJeTUIbW1hAAwhSqkuHRA3Qh2dqVYMRh0eCkFMQgPNJDDzF8y-BiaVbj80zePkK_XSfYH1aJutMtNbnsqRKWuxP31BTrMc7pdUdbE7Fma4oH8wpDUKdG3MM"}
|
||||||
18593
logs/app.log
18593
logs/app.log
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
|
@ -5183,8 +5183,7 @@ class DownloadMissingTracksModal(QDialog):
|
||||||
self.validate_slskd_result_with_spotify_parallel(best_match, spotify_track, track_index, table_index, valid_candidates, download_index)
|
self.validate_slskd_result_with_spotify_parallel(best_match, spotify_track, track_index, table_index, valid_candidates, download_index)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.on_parallel_track_failed(download_index, f"No valid results for query: {query}")
|
self.on_parallel_track_failed(download_index, f"No valid results for query: {query}")
|
||||||
|
|
||||||
|
|
||||||
def validate_slskd_result_with_spotify_parallel(self, slskd_result, original_spotify_track, track_index, table_index, valid_candidates, download_index):
|
def validate_slskd_result_with_spotify_parallel(self, slskd_result, original_spotify_track, track_index, table_index, valid_candidates, download_index):
|
||||||
"""Parallel version of Spotify validation - SIMPLIFIED for speed"""
|
"""Parallel version of Spotify validation - SIMPLIFIED for speed"""
|
||||||
|
|
@ -5309,8 +5308,11 @@ class DownloadMissingTracksModal(QDialog):
|
||||||
def _handle_processed_status_updates(self, results):
|
def _handle_processed_status_updates(self, results):
|
||||||
"""
|
"""
|
||||||
This runs on the main thread and applies status updates from the background worker.
|
This runs on the main thread and applies status updates from the background worker.
|
||||||
This is where the retry logic is triggered.
|
This is where the retry logic is triggered. Now includes a queue timeout.
|
||||||
"""
|
"""
|
||||||
|
import time
|
||||||
|
QUEUE_TIMEOUT_SECONDS = 90 # 90 seconds
|
||||||
|
|
||||||
for result in results:
|
for result in results:
|
||||||
download_index = result['widget_id']
|
download_index = result['widget_id']
|
||||||
new_status = result['status']
|
new_status = result['status']
|
||||||
|
|
@ -5322,26 +5324,35 @@ class DownloadMissingTracksModal(QDialog):
|
||||||
if result.get('transfer_id'):
|
if result.get('transfer_id'):
|
||||||
download_info['download_id'] = result['transfer_id']
|
download_info['download_id'] = result['transfer_id']
|
||||||
|
|
||||||
if new_status in ['failed', 'cancelled']:
|
# --- NEW QUEUE TIMEOUT LOGIC ---
|
||||||
print(f"Track {download_index} failed/cancelled. Triggering retry...")
|
is_stuck_in_queue = False
|
||||||
|
if new_status == 'queued':
|
||||||
|
if 'queued_start_time' not in download_info:
|
||||||
|
download_info['queued_start_time'] = time.time()
|
||||||
|
|
||||||
|
time_in_queue = time.time() - download_info['queued_start_time']
|
||||||
|
if time_in_queue > QUEUE_TIMEOUT_SECONDS:
|
||||||
|
is_stuck_in_queue = True
|
||||||
|
print(f"⏰ Download {download_index} is stuck in queue for {time_in_queue:.0f}s. Failing.")
|
||||||
|
else:
|
||||||
|
# Reset timer if it's no longer queued
|
||||||
|
if 'queued_start_time' in download_info:
|
||||||
|
del download_info['queued_start_time']
|
||||||
|
# --- END OF NEW LOGIC ---
|
||||||
|
|
||||||
|
if new_status in ['failed', 'cancelled'] or is_stuck_in_queue:
|
||||||
|
failure_reason = "Stuck in queue" if is_stuck_in_queue else f"Download {new_status}"
|
||||||
|
print(f"Track {download_index} failed/cancelled. Reason: {failure_reason}. Triggering retry...")
|
||||||
self.track_table.setItem(download_info['table_index'], 4, QTableWidgetItem("🔄 Retrying..."))
|
self.track_table.setItem(download_info['table_index'], 4, QTableWidgetItem("🔄 Retrying..."))
|
||||||
|
|
||||||
# Remove from active list so we don't check it again
|
|
||||||
self.active_downloads.remove(download_info)
|
self.active_downloads.remove(download_info)
|
||||||
|
self.retry_parallel_download_with_fallback(download_index, failure_reason)
|
||||||
# CRITICAL FIX: Do NOT call on_parallel_track_failed here.
|
|
||||||
# The retry logic now takes responsibility for the download slot.
|
|
||||||
# It will call on_parallel_track_failed itself only if all retries are exhausted.
|
|
||||||
self.retry_parallel_download_with_fallback(download_index, f"Download {new_status}")
|
|
||||||
|
|
||||||
elif new_status == 'completed':
|
elif new_status == 'completed':
|
||||||
print(f"Track {download_index} completed successfully.")
|
print(f"Track {download_index} completed successfully.")
|
||||||
self.track_table.setItem(download_info['table_index'], 4, QTableWidgetItem("✅ Downloaded"))
|
self.track_table.setItem(download_info['table_index'], 4, QTableWidgetItem("✅ Downloaded"))
|
||||||
|
|
||||||
# Remove from active downloads list
|
|
||||||
self.active_downloads.remove(download_info)
|
self.active_downloads.remove(download_info)
|
||||||
|
|
||||||
# Signal completion to the parallel download manager
|
|
||||||
self.on_parallel_track_completed(download_index, success=True)
|
self.on_parallel_track_completed(download_index, success=True)
|
||||||
|
|
||||||
elif new_status == 'downloading':
|
elif new_status == 'downloading':
|
||||||
|
|
@ -5353,7 +5364,6 @@ class DownloadMissingTracksModal(QDialog):
|
||||||
|
|
||||||
self._is_status_update_running = False
|
self._is_status_update_running = False
|
||||||
|
|
||||||
|
|
||||||
def check_transfer_folder_for_parallel_download(self, download_index):
|
def check_transfer_folder_for_parallel_download(self, download_index):
|
||||||
"""Check if a parallel download completed and exists in Transfer folder"""
|
"""Check if a parallel download completed and exists in Transfer folder"""
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue