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); } });