Feat: Implement playlist download count tracking during downloads with UI updates

This commit is contained in:
MasterAcnolo
2026-04-12 18:24:19 +02:00
parent 89573d11f7
commit a2653eef57
6 changed files with 43 additions and 4 deletions

View File

@@ -265,6 +265,7 @@
<div style="display: flex; gap: 20px; align-items: center;">
<div id="downloadProgressText"></div>
<div id="downloadSpeedText"></div>
<div id="playlistInfoText" style="display: none; font-size: 0.9rem;"></div>
<button type="button" id="stopBtn" onclick="stopDownload()" class="stop-btn" style="display:none;" title="Stop download"></button>
</div>
</div>

View File

@@ -118,4 +118,7 @@ function resetProgressBar() {
const speedElement = document.getElementById("downloadSpeedText");
if (speedElement) speedElement.style.display = "none";
const playlistInfoElement = document.getElementById("playlistInfoText");
if (playlistInfoElement) playlistInfoElement.style.display = "none";
}

View File

@@ -4,8 +4,10 @@ const progressBarText = document.getElementById("downloadProgressText")
const speedElement = document.getElementById("downloadSpeedText");
const stageElement = document.getElementById("downloadStage");
const playlistInfoElement = document.getElementById("playlistInfoText");
const speedEvt = new EventSource("/download/speed");
const stageEvt = new EventSource("/download/stage");
const playlistInfoEvt = new EventSource("/download/playlist-info");
function startProgress() {
progressBar.style.width = "0%";
@@ -45,6 +47,9 @@ function resetProgress() {
stageElement.textContent = "";
stageElement.style.display = "none";
playlistInfoElement.textContent = "";
playlistInfoElement.style.display = "none";
// Hide stop button
const stopBtn = document.getElementById("stopBtn");
if (stopBtn) stopBtn.style.display = "none";
@@ -85,4 +90,9 @@ speedEvt.onmessage = e => {
stageEvt.onmessage = e => {
stageElement.style.display = "block";
stageElement.textContent = e.data; // ex: "📥 Downloading..."
};
playlistInfoEvt.onmessage = e => {
playlistInfoElement.style.display = "block";
playlistInfoElement.textContent = e.data; // ex: "Item 1 of 15"
};