From c9939ac418671180b170c7850a231fbac01bd279 Mon Sep 17 00:00:00 2001 From: Broque Thomas Date: Sun, 4 Jan 2026 15:14:49 -0800 Subject: [PATCH] Update script.js --- webui/static/script.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/webui/static/script.js b/webui/static/script.js index 0d4b7c7e..300b68de 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -9378,6 +9378,23 @@ async function streamAlbumTrack(albumIndex, trackIndex) { const album = window.currentSearchResults[albumIndex]; console.log(`🎵 Album data:`, album); + // Surgical Fix: Handle YouTube results which are "flat" (no tracks array) + if (album.username === 'youtube') { + // For YouTube results, the "album" is actually the track itself + const track = album; + const trackData = { + ...track, + username: 'youtube', + filename: track.filename, + artist: track.artist, + album: track.title, // Use title as album name for player + title: track.title + }; + console.log(`🎵 Streaming YouTube track directly:`, trackData); + await startStream(trackData); + return; + } + if (!album.tracks || !album.tracks[trackIndex]) { console.error(`❌ No tracks in album or invalid track index. Tracks length: ${album.tracks ? album.tracks.length : 'undefined'}`); showToast('Track not found in album', 'error');