Add getSong endpoint and complete CarPlay audio streaming server
This commit is contained in:
@@ -682,6 +682,24 @@ router.get('/getPlaylist.view', authenticateSubsonic, async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Get song
|
||||||
|
router.get('/getSong.view', authenticateSubsonic, async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { id } = req.query;
|
||||||
|
const track = await get('SELECT * FROM tracks WHERE id = ?', [id]);
|
||||||
|
|
||||||
|
if (!track) {
|
||||||
|
return sendSubsonicError(res, 70, 'Song not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
const songXml = buildSongXml(track, req);
|
||||||
|
sendSubsonicResponse(res, `<song>${songXml}</song>`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error in getSong:', error);
|
||||||
|
sendSubsonicError(res, 0, error.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
router.get('/search3.view', authenticateSubsonic, async (req, res) => {
|
router.get('/search3.view', authenticateSubsonic, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user