Improve log matching and test

This commit is contained in:
2021-10-04 11:40:32 +10:30
parent 59a462eb04
commit 3bd3d30701
2 changed files with 63 additions and 1 deletions

View File

@@ -119,7 +119,7 @@ func (dl *Download) updateDownload(r io.Reader) {
func (dl *Download) updateMetadata(s string) {
// [download] 49.7% of ~15.72MiB at 5.83MiB/s ETA 00:07
etaRE := regexp.MustCompile(`download.+ETA +(\d\d:\d\d)`)
etaRE := regexp.MustCompile(`download.+ETA +(\d\d:\d\d(?::\d\d)?)$`)
matches := etaRE.FindStringSubmatch(s)
if len(matches) == 2 {
dl.Eta = matches[1]