From 899eec7dae0146dc4af145d7dd8fe64998703d4d Mon Sep 17 00:00:00 2001 From: Brandon Evans Date: Thu, 18 Feb 2021 19:16:08 -0700 Subject: [PATCH] Don't attempt to parse days from aria2c ETA I had initially suggested this but then went and checked in the source and the largest unit in the format is hours. https://github.com/aria2/aria2/blob/52da4e40ea22d1db13c1eadeac5baed4e8fd5dd8/src/util.cc#L518-L534 --- Xcodes/Backend/Progress+.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Xcodes/Backend/Progress+.swift b/Xcodes/Backend/Progress+.swift index 61d26e2..ad15f1c 100644 --- a/Xcodes/Backend/Progress+.swift +++ b/Xcodes/Backend/Progress+.swift @@ -43,16 +43,11 @@ extension Progress { } // MARK: Estimated Time Remaining - let regexETA = try! NSRegularExpression(pattern: #"(?<=ETA:)(?\d*d)?(?\d*h)?(?\d*m)?(?\d*s)?"#) + let regexETA = try! NSRegularExpression(pattern: #"(?<=ETA:)(?\d*h)?(?\d*m)?(?\d*s)?"#) if let match = regexETA.firstMatch(in: string, options: [], range: range) { var seconds: Int = 0 - if let matchRange = Range(match.range(withName: "days"), in: string), - let days = Int(string[matchRange].replacingOccurrences(of: "d", with: "")) { - seconds += (days * 60 * 60 * 24) - } - if let matchRange = Range(match.range(withName: "hours"), in: string), let hours = Int(string[matchRange].replacingOccurrences(of: "h", with: "")) { seconds += (hours * 60 * 60)