Compare commits

..

No commits in common. "398206e01c41aea8c28871a022a62b438fc3d2fa" and "ddaf4807f4b3129a2e44fe5d08b95c401bad40aa" have entirely different histories.

10 changed files with 11 additions and 120 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "twitch-vod-manager",
"version": "4.6.11",
"version": "4.6.10",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "twitch-vod-manager",
"version": "4.6.11",
"version": "4.6.10",
"license": "MIT",
"dependencies": {
"axios": "^1.6.0",

View File

@ -1,6 +1,6 @@
{
"name": "twitch-vod-manager",
"version": "4.6.11",
"version": "4.6.10",
"description": "Twitch VOD Manager - Download Twitch VODs easily",
"main": "dist/main.js",
"author": "xRangerDE",

View File

@ -4047,20 +4047,6 @@ async function downloadLiveStream(
}
const recordingStartedAt = Date.now();
// Health is derived from byte-progress liveness: each time the byte
// counter advances, we stamp lastBytesAdvancedAt; if we go BYTES_FRESH_MS
// without an advance we flip to 'stale'. Until the first byte arrives
// we report 'unknown' so the UI doesn't claim health prematurely on a
// streamlink that hasn't even hit a segment yet.
const BYTES_FRESH_MS = 30_000;
let lastBytesValue = 0;
let lastBytesAdvancedAt = 0;
let lastEmittedProgress: DownloadProgress | null = null;
const computeHealth = (): 'ok' | 'stale' | 'unknown' => {
if (lastBytesAdvancedAt === 0) return 'unknown';
return (Date.now() - lastBytesAdvancedAt) <= BYTES_FRESH_MS ? 'ok' : 'stale';
};
// Wrap onProgress so live recordings get a useful meta line. Without
// this the queue meta only shows raw bytes ("4.7 GB heruntergeladen")
@ -4069,48 +4055,24 @@ async function downloadLiveStream(
// "{HH:MM:SS} · {size} · {avg Mbps}"
// and clears speed/eta so the renderer doesn't double-up on data.
const wrappedProgress = (p: DownloadProgress): void => {
const bytes = Number(p.downloadedBytes) || 0;
if (bytes > lastBytesValue) {
lastBytesValue = bytes;
lastBytesAdvancedAt = Date.now();
}
const elapsed = Math.max(1, Math.floor((Date.now() - recordingStartedAt) / 1000));
const bytes = Number(p.downloadedBytes) || 0;
const avgBitrateMbps = (bytes * 8) / elapsed / 1_000_000;
const parts: string[] = [formatDuration(elapsed)];
if (bytes > 0) parts.push(formatBytes(bytes));
if (avgBitrateMbps > 0) parts.push(`${avgBitrateMbps.toFixed(1)} Mbps`);
const next = {
onProgress({
...p,
speed: '',
eta: '',
status: parts.join(' · '),
recordingHealth: computeHealth()
};
lastEmittedProgress = next;
onProgress(next);
status: parts.join(' · ')
});
};
// Health-tick: re-emit the most recent progress every 10s so the
// renderer's health badge updates even when streamlink is silent.
// Without this, a streamlink hung on a buffer-stall would keep showing
// 'ok' until the next real byte event — defeats the point of the badge.
const healthTick = setInterval(() => {
if (!lastEmittedProgress) return;
const updated: DownloadProgress = { ...lastEmittedProgress, recordingHealth: computeHealth() };
lastEmittedProgress = updated;
onProgress(updated);
}, 10_000);
healthTick.unref?.();
// No start/end times for live streams — streamlink records until the
// stream actually ends or we kill it. downloadVODPart already handles
// null start/end correctly.
let result: DownloadResult;
try {
result = await downloadVODPart(item.url, filename, null, null, wrappedProgress, item.id, 1, 1);
} finally {
clearInterval(healthTick);
}
const result = await downloadVODPart(item.url, filename, null, null, wrappedProgress, item.id, 1, 1);
if (chatSession) {
stopLiveChatCapture(chatSession);

View File

@ -99,7 +99,6 @@ interface QueueItem {
mergeGroup?: MergeGroup;
outputFiles?: string[];
isLive?: boolean;
recordingHealth?: 'ok' | 'stale' | 'unknown';
}
interface DownloadProgress {
@ -113,7 +112,6 @@ interface DownloadProgress {
totalParts?: number;
downloadedBytes?: number;
totalBytes?: number;
recordingHealth?: 'ok' | 'stale' | 'unknown';
}
interface RuntimeMetricsSnapshot {

View File

@ -256,12 +256,7 @@ const UI_TEXT_DE = {
ctxOpenOnTwitch: 'Auf Twitch oeffnen',
ctxRemove: 'Aus Queue entfernen',
ctxCopiedUrl: 'URL in Zwischenablage kopiert.',
liveRecordingTitle: 'Live-Aufnahme - laeuft bis der Stream endet',
recordingHealth: {
ok: 'Gesund - Bytes fliessen',
stale: 'Stillstand - keine Bytes mehr (Netz-Hickser oder Stream endet)',
unknown: 'Warte auf ersten Segment'
}
liveRecordingTitle: 'Live-Aufnahme - laeuft bis der Stream endet'
},
streamers: {
recordLiveTitle: 'Diesen Streamer live aufnehmen (laeuft bis der Stream endet)',

View File

@ -256,12 +256,7 @@ const UI_TEXT_EN = {
ctxOpenOnTwitch: 'Open on Twitch',
ctxRemove: 'Remove from queue',
ctxCopiedUrl: 'URL copied to clipboard.',
liveRecordingTitle: 'Live recording — captures until the stream ends',
recordingHealth: {
ok: 'Healthy — bytes flowing',
stale: 'Stalled — no bytes recently (network blip or stream ending)',
unknown: 'Waiting for first segment'
}
liveRecordingTitle: 'Live recording — captures until the stream ends'
},
streamers: {
recordLiveTitle: 'Record this streamer live (captures until stream ends)',

View File

@ -1,11 +1,3 @@
function renderRecordingHealthBadge(health: 'ok' | 'stale' | 'unknown' | undefined): string {
if (!health) return '';
const labels = UI_TEXT.queue.recordingHealth || { ok: 'Healthy', stale: 'Stalled', unknown: 'Pending data' };
const cls = health === 'ok' ? 'health-ok' : (health === 'stale' ? 'health-stale' : 'health-unknown');
const title = labels[health] || '';
return `<span class="queue-health-dot ${cls}" title="${escapeHtml(title)}" aria-label="${escapeHtml(title)}"></span>`;
}
function renderQueueItemFileActions(item: QueueItem): string {
if (item.status !== 'completed' || !item.outputFiles || item.outputFiles.length === 0) {
return '';
@ -531,9 +523,6 @@ function renderQueue(): void {
const liveBadge = item.isLive
? `<span class="queue-live-badge" title="${escapeHtml(UI_TEXT.queue.liveRecordingTitle)}">REC</span> `
: '';
const healthBadge = (item.isLive && item.status === 'downloading')
? renderRecordingHealthBadge(item.recordingHealth)
: '';
const mergeMetaExtra = isMergeGroup
? ` (${UI_TEXT.mergeGroup.metaLabel.replace('{count}', String(item.mergeGroup!.items.length))})`
: '';
@ -547,7 +536,7 @@ function renderQueue(): void {
<div class="status ${item.status}"></div>
<div class="queue-main">
<div class="queue-title-row">
<div class="title" title="${safeTitle}" onclick="toggleQueueDetails('${item.id}')" style="cursor:pointer">${liveBadge}${healthBadge}${mergeIcon}${isClip}${safeTitle}</div>
<div class="title" title="${safeTitle}" onclick="toggleQueueDetails('${item.id}')" style="cursor:pointer">${liveBadge}${mergeIcon}${isClip}${safeTitle}</div>
<div class="queue-status-label">${safeStatusLabel}</div>
</div>
<div class="queue-meta">${safeMeta}${mergeMetaExtra}</div>

View File

@ -116,9 +116,6 @@ async function init(): Promise<void> {
item.downloadedBytes = progress.downloadedBytes;
item.totalBytes = progress.totalBytes;
item.progressStatus = progress.status;
if (progress.recordingHealth) {
item.recordingHealth = progress.recordingHealth;
}
updateQueueItemProgress(progress);
updateStatusBarQueueSummary();
markQueueActivity();

View File

@ -694,44 +694,6 @@ body {
color: #2196f3;
}
.queue-health-dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 6px;
vertical-align: middle;
box-shadow: 0 0 4px currentColor;
}
.queue-health-dot.health-ok {
background: #00c853;
color: #00c853;
animation: queue-health-pulse 2s ease-in-out infinite;
}
.queue-health-dot.health-stale {
background: #ffab00;
color: #ffab00;
animation: queue-health-flash 1s ease-in-out infinite;
}
.queue-health-dot.health-unknown {
background: var(--text-secondary);
color: var(--text-secondary);
box-shadow: none;
}
@keyframes queue-health-pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.55; }
}
@keyframes queue-health-flash {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
.queue-live-badge {
display: inline-block;
background: #ff4444;

View File

@ -52,12 +52,6 @@ export interface QueueItem {
// filename includes a timestamp so consecutive live recordings of the
// same streamer don't collide.
isLive?: boolean;
// Live recording health snapshot. 'ok' means bytes are flowing within
// the freshness window, 'stale' means the streamlink subprocess hasn't
// pushed bytes recently (dropped segments, network blip, or stream just
// ended), 'unknown' until the first progress event arrives. Only set
// for in-flight live recordings; cleared when the recording finishes.
recordingHealth?: 'ok' | 'stale' | 'unknown';
}
export interface DownloadProgress {
@ -71,7 +65,6 @@ export interface DownloadProgress {
totalParts?: number;
downloadedBytes?: number;
totalBytes?: number;
recordingHealth?: 'ok' | 'stale' | 'unknown';
}
export interface DownloadResult {