diff --git a/backend/novasonic-server.js b/backend/novasonic-server.js index aaee6ed..85f53cb 100644 --- a/backend/novasonic-server.js +++ b/backend/novasonic-server.js @@ -648,6 +648,7 @@ app.post('/api/fix-artist-sort', async (req, res) => { updateJob(jobId, { status: 'running', progress: 10, message: `${songs.length} Songs gefunden…` }); let done = 0, errors = 0; + const errorDetails = []; const safeArtistDir = sanitize(artistSort.split(/[,;&]/)[0].trim()); for (const ndSong of songs) { @@ -663,7 +664,12 @@ app.post('/api/fix-artist-sort', async (req, res) => { || _findFileRecursive(CONFIG.musicPath, fileName) || _findFileByStemOrRomaji(CONFIG.musicPath, titleStem); if (found) filePath = found; - else { log(jobId, `⚠ Nicht gefunden: ${path.basename(ndSong.path || '')}`); errors++; continue; } + else { + const detail = `Nicht gefunden: ${path.basename(ndSong.path || '')}`; + log(jobId, `⚠ ${detail}`); + errorDetails.push(detail); + errors++; continue; + } } const fileExt = path.extname(filePath); @@ -710,7 +716,9 @@ app.post('/api/fix-artist-sort', async (req, res) => { updateJob(jobId, { progress: 10 + Math.round((done / songs.length) * 80), message: `${done}/${songs.length} Songs aktualisiert…` }); log(jobId, `✅ ${ndSong.title}`); } catch (e) { - log(jobId, `❌ ${ndSong.title}: ${e.message}`); + const detail = `${ndSong.title}: ${e.message}`; + log(jobId, `❌ ${detail}`); + errorDetails.push(detail); errors++; } } @@ -721,7 +729,10 @@ app.post('/api/fix-artist-sort', async (req, res) => { await fetch(`${ndUrl}/rest/startScan?u=${encodeURIComponent(user)}&t=${t}&s=${s}&v=1.16.1&c=novasonic&f=json`, { signal: AbortSignal.timeout(5000) }); } catch {} - const msg = errors > 0 ? `${done} aktualisiert, ${errors} Fehler` : `${done} Songs aktualisiert`; + const firstErr = errorDetails[0] ? ` (${errorDetails[0]})` : ''; + const msg = errors > 0 + ? `${done} aktualisiert, ${errors} Fehler${firstErr}` + : `${done} Songs aktualisiert`; updateJob(jobId, { status: 'done', progress: 100, message: msg }); })().catch(e => updateJob(jobId, { status: 'error', message: e.message })); });