From f9f0d100426d3aedec73410647f6e7c49084db98 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Sun, 7 Dec 2025 23:32:20 +0000 Subject: [PATCH] Add getSong endpoint and complete CarPlay audio streaming server --- src/routes/subsonic.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/routes/subsonic.js b/src/routes/subsonic.js index c1c224b..7c50d9c 100644 --- a/src/routes/subsonic.js +++ b/src/routes/subsonic.js @@ -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, `${songXml}`); + } catch (error) { + console.error('Error in getSong:', error); + sendSubsonicError(res, 0, error.message); + } +}); + // Search router.get('/search3.view', authenticateSubsonic, async (req, res) => { try {