diff --git a/src/main.ts b/src/main.ts index 27be3ac..3900dc1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2685,11 +2685,26 @@ function downloadVODPart( lastBytes = downloadedBytes; lastTime = now; + let etaStr = ''; + if (speed > 0 && downloadedBytes > 0) { + const elapsedSec = (Date.now() - downloadStartTime) / 1000; + if (elapsedSec > 3) { + const avgSpeed = downloadedBytes / elapsedSec; + if (expectedDurationSeconds && expectedDurationSeconds > 0) { + const estimatedTotalBytes = avgSpeed * expectedDurationSeconds; + if (estimatedTotalBytes > downloadedBytes) { + const remainingSec = (estimatedTotalBytes - downloadedBytes) / avgSpeed; + etaStr = formatETA(remainingSec); + } + } + } + } + onProgress({ id: itemId, progress: -1, // Unknown total speed: formatSpeed(speed), - eta: '', + eta: etaStr, status: `${formatBytes(downloadedBytes)} heruntergeladen`, currentPart: partNum, totalParts: totalParts,