diff --git a/src/ui.js b/src/ui.js index bfdaa13..d9c4cd5 100644 --- a/src/ui.js +++ b/src/ui.js @@ -314,6 +314,7 @@ async function _createNdPlaylist(tracks, name) { try { toast('🎵 Erstelle Navidrome-Playlist…'); const songIds = []; + const missing = []; const norm = s => s?.toLowerCase().trim() || ''; for (const t of tracks) { if (!t.trackName) continue; @@ -325,15 +326,19 @@ async function _createNdPlaylist(tracks, name) { norm(s.artist).split(' ')[0] === norm(t.artistName).split(' ')[0] ) || songs.find(s => norm(s.title) === norm(t.trackName)); if (match) songIds.push(match.id); - } catch {} + else missing.push(t.trackName); + } catch { missing.push(t.trackName); } } if (!songIds.length) { toast('⚠ Keine Tracks in Navidrome gefunden — zuerst Library scannen, dann Playlist manuell anlegen'); + _addNotif({ id: 'pl_' + Date.now(), title: `Playlist: ${name}`, artist: '', status: 'error', message: 'Keine Tracks in Navidrome gefunden — Library scan nötig', missing, timestamp: Date.now(), read: false }); return; } const songParams = songIds.map(id => `&songId=${encodeURIComponent(id)}`).join(''); await api('createPlaylist', `&name=${encodeURIComponent(name)}${songParams}`); + const msg = `${songIds.length}/${tracks.length} Tracks hinzugefügt${missing.length ? `, ${missing.length} nicht gefunden` : ''}`; toast(`✅ Playlist "${name}" mit ${songIds.length}/${tracks.length} Tracks erstellt`); + _addNotif({ id: 'pl_' + Date.now(), title: `Playlist: ${name}`, artist: '', status: 'done', message: msg, missing, timestamp: Date.now(), read: false }); } catch(e) { toast('Playlist-Erstellung fehlgeschlagen: ' + e.message); } @@ -408,6 +413,9 @@ function _renderNotifList() { const failedHtml = n.failed?.length ? `
${n.failed.length} Track${n.failed.length > 1 ? 's' : ''} fehlgeschlagen
` : ''; + const missingHtml = n.missing?.length + ? `
${n.missing.length} Track${n.missing.length > 1 ? 's' : ''} nicht in Navidrome gefunden
` + : ''; return `
${icon} @@ -419,6 +427,7 @@ function _renderNotifList() {
${n.message ? `
${esc(n.message)}
` : ''} ${failedHtml} + ${missingHtml}
`; }).join(''); }