diff --git a/core/wishlist_service.py b/core/wishlist_service.py index c6d102f0..47825780 100644 --- a/core/wishlist_service.py +++ b/core/wishlist_service.py @@ -108,6 +108,17 @@ class WishlistService: wishlist_tracks = self.database.get_wishlist_tracks(limit=limit) formatted_tracks = [] + # Sort by artist name, then track name for consistent display order + try: + wishlist_tracks.sort(key=lambda x: ( + x['spotify_data'].get('artists', [{}])[0].get('name', '').lower(), + x['spotify_data'].get('name', '').lower() + )) + logger.debug(f"Successfully sorted {len(wishlist_tracks)} wishlist tracks by artist/track name") + except Exception as sort_error: + logger.warning(f"Failed to sort wishlist tracks, using original order: {sort_error}") + # Continue with original database order (date_added) + for wishlist_track in wishlist_tracks: spotify_data = wishlist_track['spotify_data'] diff --git a/database/music_database.py b/database/music_database.py index 18b8d4ce..c4bda2e5 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -1914,7 +1914,7 @@ class MusicDatabase: SELECT id, spotify_track_id, spotify_data, failure_reason, retry_count, last_attempted, date_added, source_type, source_info FROM wishlist_tracks - ORDER BY RANDOM() + ORDER BY date_added """ if limit: diff --git a/docker-compose.yml b/docker-compose.yml index 240e4efe..20763921 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,8 @@ services: # IMPORTANT: Mount the drives containing your download and transfer folders # If your download/transfer paths are on E: drive, mount E: drive: - /mnt/e:/host/mnt/e:rw + # Mount H: drive for transfer folder + - /mnt/h:/host/mnt/h:rw # If your download/transfer paths are on C: drive, uncomment this line: # - /mnt/c:/host/mnt/c:rw # If your download/transfer paths are on D: drive, uncomment this line: diff --git a/web_server.py b/web_server.py index cf8e335b..bfa37ba0 100644 --- a/web_server.py +++ b/web_server.py @@ -6083,6 +6083,19 @@ def _process_failed_tracks_to_wishlist_exact(batch_id): permanently_failed_tracks = batch.get('permanently_failed_tracks', []) cancelled_tracks = batch.get('cancelled_tracks', set()) + # STEP 0: Remove completed tracks from wishlist (THIS WAS MISSING!) + print(f"🔍 [Wishlist Processing] Checking completed tracks for wishlist removal") + for task_id in batch.get('queue', []): + if task_id in download_tasks: + task = download_tasks[task_id] + if task.get('status') == 'completed': + try: + track_info = task.get('track_info', {}) + context = {'track_info': track_info, 'original_search_result': track_info} + _check_and_remove_from_wishlist(context) + except Exception as e: + print(f"⚠️ [Wishlist Processing] Error removing completed track from wishlist: {e}") + # STEP 1: Add cancelled tracks that were missing to permanently_failed_tracks (replicating sync.py) # This matches sync.py's logic for adding cancelled missing tracks to the failed list if cancelled_tracks: