Make it on par with the old controller.

This commit is contained in:
Damiano Galassi committed 2017-08-01 12:27:03 +02:00
1 parent 747eb97682
commit 1be37f9e15
2 files changed
+34 -5

No files matched your search

+8 -2
View File
@@ -15,8 +15,14 @@ public struct ChapterDB : ChapterService {
let data = fetch(url: url)
else { return [] }
let delta: Int64 = 10000
return parse(data: data).filter { $0.duration < (Int64(duration) + delta) && $0.duration > (Int64(duration) - delta) }
let parsed = parse(data: data)
if (duration > 0) {
let delta: Int64 = 10000
return parsed.filter { $0.duration < (Int64(duration) + delta) && $0.duration > (Int64(duration) - delta) }
}
else {
return parsed
}
}
private func fetch(url: URL) -> Data? {