From 15ee2006151236f14bc11a17472e1690cc9282dc Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Sat, 9 Apr 2022 17:46:03 +0930 Subject: [PATCH] Alternative download ETA string --- download/download.go | 3 ++- download/download_test.go | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/download/download.go b/download/download.go index 43ab69e..1301445 100644 --- a/download/download.go +++ b/download/download.go @@ -266,7 +266,8 @@ func (dl *Download) updateMetadata(s string) { defer dl.mutex.Unlock() // [download] 49.7% of ~15.72MiB at 5.83MiB/s ETA 00:07 - etaRE := regexp.MustCompile(`download.+ETA +(\d\d:\d\d(?::\d\d)?)$`) + // [download] 99.3% of ~1.42GiB at 320.87KiB/s ETA 00:07 (frag 212/214) + etaRE := regexp.MustCompile(`download.+ETA +(\d\d:\d\d(?::\d\d)?)`) matches := etaRE.FindStringSubmatch(s) if len(matches) == 2 { dl.Eta = matches[1] diff --git a/download/download_test.go b/download/download_test.go index cd7bf70..5230385 100644 --- a/download/download_test.go +++ b/download/download_test.go @@ -40,6 +40,14 @@ func TestUpdateMetadata(t *testing.T) { t.Fatalf("%v", newD.Files) } + // different download + newD.updateMetadata("[download] 99.3% of ~1.42GiB at 320.87KiB/s ETA 00:07 (frag 212/214)") + if newD.Eta != "00:07" { + t.Fatalf("bad short eta in dl with frag\n%v", newD) + } + + // [FixupM3u8] Fixing MPEG-TS in MP4 container of "file [-168849776_456239489].mp4" + // deletes // TODO. Not sure why I don't always see the "Deleting original file" messages after merge - // maybe a youtube-dl fork thing?