Fix stream endpoint to use configured library path
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user