diff --git a/backend/novasonic-server.js b/backend/novasonic-server.js index e19cf24..f61ebbe 100644 --- a/backend/novasonic-server.js +++ b/backend/novasonic-server.js @@ -564,7 +564,8 @@ app.post('/api/spotify/resolve', async (req, res) => { }); app.post('/api/download', async (req, res) => { - const { type, artist, title, album, artworkUrl, collectionId, jobId: clientJobId, explicit } = req.body; + const { type, artist, title, album, artworkUrl, collectionId, jobId: clientJobId, explicit, + trackNum: bodyTrackNum, totalTracks: bodyTotalTracks, discNum: bodyDiscNum, discTotal: bodyDiscTotal } = req.body; if (!artist || !title) return res.status(400).json({ error: 'artist and title required' }); const jobId = clientJobId || ('job_' + Date.now()); @@ -584,7 +585,11 @@ app.post('/api/download', async (req, res) => { const spAlbum = sp.collectionName || album || ''; const spArt = sp.artworkUrl100 || artworkUrl || ''; const spYear = sp.releaseDate ? new Date(sp.releaseDate).getFullYear() : undefined; - let meta = { album: spAlbum, year: spYear, trackNum: sp.trackNumber || undefined, + let meta = { album: spAlbum, year: spYear, + trackNum: sp.trackNumber || bodyTrackNum || undefined, + totalTracks: sp.trackCount || bodyTotalTracks || undefined, + discNum: sp.discNumber || bodyDiscNum || undefined, + discTotal: sp.discCount || bodyDiscTotal || undefined, artworkUrl: spArt, explicit: sp.trackExplicitness === 'explicit' || !!explicit }; if (!meta.album) { // Use first artist only for iTunes search (multi-artist strings like "Kløn, Renzyx" confuse iTunes) diff --git a/src/ui.js b/src/ui.js index 71b823b..4dc9044 100644 --- a/src/ui.js +++ b/src/ui.js @@ -290,10 +290,14 @@ export async function executeDownload() { artist: S.downloadTarget.artistName || 'Unknown Artist', title: S.downloadTarget.trackName || S.downloadTarget.collectionName || 'Unknown', album: S.downloadTarget.collectionName || '', - artworkUrl: S.downloadTarget.artworkUrl100 || S.downloadTarget.artworkUrl60 || '', - itunesId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null, + artworkUrl: S.downloadTarget.artworkUrl100 || S.downloadTarget.artworkUrl60 || '', + itunesId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null, collectionId: S.downloadTarget.collectionId || null, - explicit: S.downloadTarget.trackExplicitness === 'explicit', + explicit: S.downloadTarget.trackExplicitness === 'explicit', + trackNum: S.downloadTarget.trackNumber || undefined, + totalTracks: S.downloadTarget.trackCount || undefined, + discNum: S.downloadTarget.discNumber || undefined, + discTotal: S.downloadTarget.discCount || undefined, }; addJob(jobId, payload.title, payload.artist, payload.type); try {