feat: show iTunes enrichment status indicator in Spotify importer
This commit is contained in:
1 parent
11dec04fea
commit
55370ad760
3 files changed
+29
No files matched your search
@@ -189,6 +189,26 @@ function _renderSpotifyPreview(data) {
|
||||
}
|
||||
}
|
||||
|
||||
function _setEnrichStatus(done, current, total) {
|
||||
const el = document.getElementById('spotify-enrich-status');
|
||||
if (!el) return;
|
||||
if (done) {
|
||||
el.className = 'done';
|
||||
el.innerHTML = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg> iTunes-Daten geladen';
|
||||
el.style.display = 'flex';
|
||||
el.style.opacity = '1';
|
||||
setTimeout(() => {
|
||||
el.style.opacity = '0';
|
||||
setTimeout(() => { el.style.display = 'none'; el.className = ''; }, 400);
|
||||
}, 2000);
|
||||
} else {
|
||||
el.className = '';
|
||||
el.innerHTML = `<div class="enrich-spinner"></div> Lade iTunes-Daten… (${current}/${total})`;
|
||||
el.style.display = 'flex';
|
||||
el.style.opacity = '1';
|
||||
}
|
||||
}
|
||||
|
||||
async function _loadSpotifyTrackArtwork(tracks, listEl) {
|
||||
const artEls = listEl.querySelectorAll('.gtrack-art');
|
||||
|
||||
@@ -203,6 +223,8 @@ async function _loadSpotifyTrackArtwork(tracks, listEl) {
|
||||
|
||||
// Enrich each track with iTunes data — same call as global search
|
||||
const CONC = 4;
|
||||
let enriched = 0;
|
||||
_setEnrichStatus(false, 0, tracks.length);
|
||||
for (let i = 0; i < tracks.length; i += CONC) {
|
||||
const batch = tracks.slice(i, i + CONC);
|
||||
await Promise.all(batch.map(async (t, bi) => {
|
||||
@@ -239,8 +261,11 @@ async function _loadSpotifyTrackArtwork(tracks, listEl) {
|
||||
}
|
||||
}
|
||||
} catch { /* non-critical */ }
|
||||
enriched++;
|
||||
_setEnrichStatus(false, enriched, tracks.length);
|
||||
}));
|
||||
}
|
||||
_setEnrichStatus(true);
|
||||
}
|
||||
|
||||
function _startRateLimitCountdown(inner, totalSecs) {
|
||||
|
||||
Reference in new issue
Block a user