2 Commits

+10 -1
View File
@@ -266,7 +266,7 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
func getMetadataFromFilename(path: URL) { func getMetadataFromFilename(path: URL) {
// Beautiful, is it not? // Beautiful, is it not?
let patterns: [(NSRegularExpression, NSRegularExpression, Int, Int, Int)] = [ let patterns: [(NSRegularExpression, NSRegularExpression, Int, Int, Int)] = [
(try! NSRegularExpression(pattern: #"c([0-9]+(?:x[0-9]+)?) \(v([0-9]+)\) - p([0-9]+(?:-[0-9]+)?)"#), try! NSRegularExpression(pattern: #"^(.*) - c([0-9]+(?:x[0-9]+)?) \(v([0-9]+)\) - p([0-9]+(?:-[0-9]+)?)"#), 3, 1, 2), (try! NSRegularExpression(pattern: #"c([0-9]+(?:x[0-9]+)?) \(v([0-9]+)\) - p([0-9]+(?:-p?[0-9]+)?)"#), try! NSRegularExpression(pattern: #"^(.*) - c([0-9]+(?:x[0-9]+)?) \(v([0-9]+)\) - p([0-9]+(?:-p?[0-9]+)?)"#), 3, 1, 2),
(try! NSRegularExpression(pattern: "v([0-9]+) p([0-9]+(?:-[0-9]+)?) - c([0-9]+(?:x[0-9]+)?)"), try! NSRegularExpression(pattern: "^(.*) - v([0-9]+) p([0-9]+(?:-[0-9]+)?) - c([0-9]+(?:x[0-9]+)?)"), 2, 3, 1), (try! NSRegularExpression(pattern: "v([0-9]+) p([0-9]+(?:-[0-9]+)?) - c([0-9]+(?:x[0-9]+)?)"), try! NSRegularExpression(pattern: "^(.*) - v([0-9]+) p([0-9]+(?:-[0-9]+)?) - c([0-9]+(?:x[0-9]+)?)"), 2, 3, 1),
] ]
var pattern: NSRegularExpression! = nil var pattern: NSRegularExpression! = nil
@@ -676,6 +676,15 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
if scrollingCollectionView.isHidden == true || mode != .scroll if scrollingCollectionView.isHidden == true || mode != .scroll
|| scrollingCollectionView.contentSize == .zero || scrollingCollectionView.contentSize == .zero
{ {
if metadata == nil { return }
imageLoader.loadImage(
archiveURL: getArchiveURL(progress.v),
filename: getImagePath(progress),
scaling: .scaleAspectFit,
screenSize: UIScreen.main.bounds.size
) { image in
self.imageView.image = image
}
return return
} }
if !hasSetContentOffset, scrollPos != nil { if !hasSetContentOffset, scrollPos != nil {