From c6de707f94c6ad250b4335d7e2f7b37627381d89 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sat, 18 Apr 2026 19:46:20 -0700 Subject: [PATCH] Fix single track search results downloading with album context When clicking a track in enhanced or global search, the download modal correctly showed SINGLE but the download used is_album_download=true, causing the file to be organized under the album path template instead of the singles template. Now enhanced_search_track_ and gsearch_track_ prefixes pass album metadata for tagging but set is_album_download=false. --- webui/static/script.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/webui/static/script.js b/webui/static/script.js index 546d9454..4e9abacc 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -14973,13 +14973,16 @@ async function startMissingTracksProcess(playlistId) { }; // If this is an artist album download, use album name and include full context - // Match 'artist_album_', 'enhanced_search_album_', 'enhanced_search_track_', 'discover_album_', and 'seasonal_album_' prefixes - if (playlistId.startsWith('artist_album_') || playlistId.startsWith('enhanced_search_album_') || playlistId.startsWith('enhanced_search_track_') || playlistId.startsWith('discover_album_') || playlistId.startsWith('seasonal_album_') || playlistId.startsWith('spotify_library_') || playlistId.startsWith('issue_download_') || playlistId.startsWith('library_redownload_') || playlistId.startsWith('beatport_release_')) { + // Match 'artist_album_', 'enhanced_search_album_', 'discover_album_', and 'seasonal_album_' prefixes + // Note: 'enhanced_search_track_' is excluded — single track search results use singles context + const _isAlbumContext = playlistId.startsWith('artist_album_') || playlistId.startsWith('enhanced_search_album_') || playlistId.startsWith('discover_album_') || playlistId.startsWith('seasonal_album_') || playlistId.startsWith('spotify_library_') || playlistId.startsWith('issue_download_') || playlistId.startsWith('library_redownload_') || playlistId.startsWith('beatport_release_'); + const _isSearchTrack = playlistId.startsWith('enhanced_search_track_') || playlistId.startsWith('gsearch_track_'); + if (_isAlbumContext || _isSearchTrack) { requestBody.playlist_name = process.album?.name || process.playlist.name; - requestBody.is_album_download = true; + requestBody.is_album_download = _isAlbumContext; // false for single track search results requestBody.album_context = process.album; // Full Spotify album object requestBody.artist_context = process.artist; // Full Spotify artist object - console.log(`🎵 [Artist Album] Sending album context: ${process.album?.name} by ${process.artist?.name}`); + console.log(`🎵 [${_isAlbumContext ? 'Album' : 'Single Track'}] Sending context: ${process.album?.name} by ${process.artist?.name}`); } else { // For playlists/wishlists, use the virtual playlist name requestBody.playlist_name = process.playlist.name;