fix: remove --progress-template, parse default [download] output instead
All checks were successful
CI / build (push) Successful in 40s
All checks were successful
CI / build (push) Successful in 40s
--progress-template output is suppressed in non-TTY subprocesses (yt-dlp issue #13649). The default [download] progress format works reliably in pipes. Changes: - Remove --progress-template from yt-dlp args entirely - Keep --newline for newline-delimited output in pipe - Fix progressRE regex to handle HLS format: ~ with leading spaces before size (e.g. '~ 1.00KiB') - Fix speed parsing in [download] fallback to handle multiple leading spaces (e.g. 'at 976.20B/s') - Fix ETA parsing to strip (frag n/m) suffix - Filter Unknown/N/A speed/eta in [download] fallback - Add test cases for real HLS fragment output format
This commit is contained in:
@@ -67,6 +67,27 @@ func TestParseProgressLine(t *testing.T) {
|
||||
eta: "00:02",
|
||||
hasRes: true,
|
||||
},
|
||||
{
|
||||
line: "[download] 100.0% of ~ 1.00KiB at 976.20B/s ETA Unknown (frag 0/18)",
|
||||
pct: 100.0,
|
||||
speed: "976.20B/s",
|
||||
eta: "",
|
||||
hasRes: true,
|
||||
},
|
||||
{
|
||||
line: "[download] 16.7% of ~ 18.00KiB at 976.20B/s ETA Unknown (frag 0/18)",
|
||||
pct: 16.7,
|
||||
speed: "976.20B/s",
|
||||
eta: "",
|
||||
hasRes: true,
|
||||
},
|
||||
{
|
||||
line: "[download] 11.1% of ~ 8.34MiB at 716.47KiB/s ETA 00:08 (frag 1/18)",
|
||||
pct: 11.1,
|
||||
speed: "716.47KiB/s",
|
||||
eta: "00:08",
|
||||
hasRes: true,
|
||||
},
|
||||
{
|
||||
line: "[download] 1.2% of unknown size at 0.00B/s ETA Unknown",
|
||||
hasRes: false,
|
||||
@@ -196,6 +217,9 @@ func TestParseProgressLineEdgeCases(t *testing.T) {
|
||||
{"[download] 0.0% of 1.00GiB at 0.00B/s ETA 00:00", "multiple spaces", true},
|
||||
{"[download] 100.0% of 1.00GiB at 999.99MiB/s ETA 00:00", "high speed", true},
|
||||
{"[download] 100.0% of 999.99TiB at 1.00TiB/s ETA 00:00", "large numbers", true},
|
||||
{"[download] 100.0% of ~ 1.00KiB at 976.20B/s ETA Unknown (frag 0/18)", "hls frag first", true},
|
||||
{"[download] 16.7% of ~ 18.00KiB at 976.20B/s ETA Unknown (frag 0/18)", "hls frag", true},
|
||||
{"[download] 11.1% of ~ 8.34MiB at 716.47KiB/s ETA 00:08 (frag 1/18)", "hls frag with eta", true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user