mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
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. 52da4e40ea/src/util.cc (L518-L534)
This commit is contained in:
parent
e301ad8818
commit
899eec7dae
1 changed files with 1 additions and 6 deletions
|
|
@ -43,16 +43,11 @@ extension Progress {
|
|||
}
|
||||
|
||||
// MARK: Estimated Time Remaining
|
||||
let regexETA = try! NSRegularExpression(pattern: #"(?<=ETA:)(?<days>\d*d)?(?<hours>\d*h)?(?<minutes>\d*m)?(?<seconds>\d*s)?"#)
|
||||
let regexETA = try! NSRegularExpression(pattern: #"(?<=ETA:)(?<hours>\d*h)?(?<minutes>\d*m)?(?<seconds>\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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue