Print image overviews
This commit is contained in:
parent
b39066f47f
commit
31edd35463
@ -23,9 +23,9 @@ enum ThumbnailStyle: String, CaseIterable {
|
|||||||
case .large:
|
case .large:
|
||||||
return 374
|
return 374
|
||||||
case .square:
|
case .square:
|
||||||
return height
|
return 178
|
||||||
case .small:
|
case .small:
|
||||||
return height
|
return 78
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ final class ImageGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func requireImage(at destination: String, generatedFrom source: String, requiredBy path: String, width: Int, height: Int?) -> NSSize {
|
func requireImage(at destination: String, generatedFrom source: String, requiredBy path: String, width: Int, height: Int?) -> NSSize {
|
||||||
|
requiredImages.insert(destination)
|
||||||
let height = height.unwrapped(CGFloat.init)
|
let height = height.unwrapped(CGFloat.init)
|
||||||
let sourceUrl = input.appendingPathComponent(source)
|
let sourceUrl = input.appendingPathComponent(source)
|
||||||
guard sourceUrl.exists else {
|
guard sourceUrl.exists else {
|
||||||
@ -158,6 +159,8 @@ final class ImageGenerator {
|
|||||||
}
|
}
|
||||||
printMissingImages()
|
printMissingImages()
|
||||||
printImageWarnings()
|
printImageWarnings()
|
||||||
|
printGeneratedImages()
|
||||||
|
printTotalImageCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func printMissingImages() {
|
private func printMissingImages() {
|
||||||
@ -180,6 +183,20 @@ final class ImageGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func printGeneratedImages() {
|
||||||
|
guard !generatedImages.isEmpty else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
print("\(generatedImages.count) images generated:")
|
||||||
|
for image in generatedImages {
|
||||||
|
print(" " + image)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func printTotalImageCount() {
|
||||||
|
print("\(requiredImages.count) images")
|
||||||
|
}
|
||||||
|
|
||||||
private func addWarning(_ message: String, destination: String, path: String) {
|
private func addWarning(_ message: String, destination: String, path: String) {
|
||||||
let warning = " \(destination): \(message) required by \(path)"
|
let warning = " \(destination): \(message) required by \(path)"
|
||||||
imageWarnings.insert(warning)
|
imageWarnings.insert(warning)
|
||||||
@ -269,5 +286,6 @@ final class ImageGenerator {
|
|||||||
addWarning("Failed to write image (\(error))", job: job)
|
addWarning("Failed to write image (\(error))", job: job)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
generatedImages.insert(job.destination)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user