From 43bcaa88a6e312fb40c0528defa1f6d43ac1cfbd Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Sun, 7 Dec 2025 23:28:38 +0000 Subject: [PATCH] Fix stream endpoint to use configured library path --- src/routes/subsonic.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/routes/subsonic.js b/src/routes/subsonic.js index d76023e..15d69de 100644 --- a/src/routes/subsonic.js +++ b/src/routes/subsonic.js @@ -542,9 +542,19 @@ router.get('/stream.view', authenticateSubsonic, async (req, res) => { return sendSubsonicError(res, 70, 'Song not found'); } - const filePath = `${process.cwd()}/audio_library/${track.file_path}`; + // Use the configured library path from settings + const { loadConfig } = await import('../routes/settings.js'); + const config = await loadConfig(); + const libraryPath = path.isAbsolute(config.libraryPath) + ? config.libraryPath + : path.join(process.cwd(), config.libraryPath); + + const filePath = path.join(libraryPath, track.file_path); + + console.log(`🎵 Streaming: ${filePath}`); res.sendFile(filePath); } catch (error) { + console.error('Error streaming:', error); sendSubsonicError(res, 0, error.message); } });