From 835ddcdbd5f4ad9b9b7e1c32060ae47fb004ba33 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Thu, 26 Mar 2026 19:48:03 -0700 Subject: [PATCH] Fall back to stream source when library file not found on disk When clicking play on an "In Library" track, if the file can't be resolved on disk (e.g., media server path not accessible from SoulSync), silently falls back to streaming via the configured stream source instead of showing an error. --- webui/static/script.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/webui/static/script.js b/webui/static/script.js index 87602447..5a195fe2 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -43225,6 +43225,27 @@ async function playLibraryTrack(track, albumTitle, artistName) { const result = await response.json(); if (!result.success) { + // File not on disk — fall back to streaming from configured source + console.warn('Library file not found, falling back to stream source'); + hideLoadingAnimation(); + const streamRes = await fetch('/api/enhanced-search/stream-track', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + track_name: track.title || '', + artist_name: artistName || '', + album_name: albumTitle || '', + }) + }); + const streamData = await streamRes.json(); + if (streamData.success && streamData.result) { + streamData.result.artist = artistName; + streamData.result.title = track.title; + streamData.result.album = albumTitle; + streamData.result.image_url = track._stats_image || null; + startStream(streamData.result); + return; + } throw new Error(result.error || 'Failed to start library playback'); }