Add getSong endpoint and complete CarPlay audio streaming server

This commit is contained in:
2025-12-07 23:32:20 +00:00
parent 9f29f94ae4
commit f9f0d10042

View File

@@ -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 {