fix: send track/disc numbers from iTunes to backend; backend reads them for single track downloads
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
45b1eb2e44
commit
2b1eff2762
2 files changed
+11
-2
No files matched your search
@@ -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)
|
||||
|
||||
@@ -294,6 +294,10 @@ export async function executeDownload() {
|
||||
itunesId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null,
|
||||
collectionId: S.downloadTarget.collectionId || null,
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user