Compare commits
2 Commits
a07ec1f958
...
d9bdf744fd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9bdf744fd | ||
|
|
d8f0836165 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "twitch-vod-manager",
|
||||
"version": "4.5.4",
|
||||
"version": "4.5.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "twitch-vod-manager",
|
||||
"version": "4.5.4",
|
||||
"version": "4.5.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "twitch-vod-manager",
|
||||
"version": "4.5.4",
|
||||
"version": "4.5.5",
|
||||
"description": "Twitch VOD Manager - Download Twitch VODs easily",
|
||||
"main": "dist/main.js",
|
||||
"author": "xRangerDE",
|
||||
|
||||
20
src/main.ts
20
src/main.ts
@ -2203,6 +2203,7 @@ function downloadVODPart(
|
||||
const args = [...streamlinkCmd.prefixArgs, url, 'best', '-o', filename, '--force'];
|
||||
let lastErrorLine = '';
|
||||
const expectedDurationSeconds = parseClockDurationSeconds(endTime);
|
||||
let lastStreamlinkPercent = 0;
|
||||
|
||||
if (startTime) {
|
||||
args.push('--hls-start-offset', startTime);
|
||||
@ -2250,22 +2251,16 @@ function downloadVODPart(
|
||||
lastTime = now;
|
||||
|
||||
let etaStr = '';
|
||||
if (speed > 0 && downloadedBytes > 0) {
|
||||
const itemStartTime = itemTracking.startTime;
|
||||
const elapsedSec = (Date.now() - itemStartTime) / 1000;
|
||||
if (elapsedSec > 5) { // Wait at least 5 seconds before showing ETA
|
||||
const avgSpeed = downloadedBytes / elapsedSec;
|
||||
if (expectedDurationSeconds && expectedDurationSeconds > 0) {
|
||||
const estimatedTotalBytes = avgSpeed * expectedDurationSeconds;
|
||||
if (estimatedTotalBytes > downloadedBytes) {
|
||||
const remainingSec = (estimatedTotalBytes - downloadedBytes) / avgSpeed;
|
||||
if (remainingSec > 0 && remainingSec < 86400) { // Between 0 and 24 hours
|
||||
if (downloadedBytes > 0) {
|
||||
const elapsedSec = (Date.now() - (itemTracking?.startTime || Date.now())) / 1000;
|
||||
if (elapsedSec > 5 && lastStreamlinkPercent > 1) {
|
||||
// Use streamlink's reported progress for accurate ETA
|
||||
const remainingSec = (elapsedSec / lastStreamlinkPercent) * (100 - lastStreamlinkPercent);
|
||||
if (remainingSec > 0 && remainingSec < 86400) {
|
||||
etaStr = formatETA(remainingSec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onProgress({
|
||||
id: itemId,
|
||||
@ -2290,6 +2285,7 @@ function downloadVODPart(
|
||||
const match = line.match(/(\d+\.\d+)%/);
|
||||
if (match) {
|
||||
const percent = parseFloat(match[1]);
|
||||
lastStreamlinkPercent = percent;
|
||||
onProgress({
|
||||
id: itemId,
|
||||
progress: percent,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user