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 {