1.1 --- a/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/Counters.java Mon Nov 17 20:05:57 2014 +0100
1.2 +++ b/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/Counters.java Mon Nov 17 20:13:15 2014 +0100
1.3 @@ -64,7 +64,7 @@
1.4 DIRECTORIES,
1.5 FILES,
1.6 RESIZED,
1.7 - SKIPPED_SMALLER,
1.8 + JUST_COPIED,
1.9 SKIPPED_UNKNOWN_EXTENSION,
1.10 SKIPPED_ERROR;
1.11
2.1 --- a/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/RecursiveImageResizer.java Mon Nov 17 20:05:57 2014 +0100
2.2 +++ b/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/RecursiveImageResizer.java Mon Nov 17 20:13:15 2014 +0100
2.3 @@ -37,7 +37,7 @@
2.4 public class RecursiveImageResizer {
2.5
2.6 private static final Logger log = Logger.getLogger(RecursiveImageResizer.class.getName());
2.7 -
2.8 +
2.9 private final Counters counters = new Counters();
2.10
2.11 private final SingleImageResizer resizer = new SingleImageResizer();
2.12 @@ -56,11 +56,13 @@
2.13 private void resizeFile(File inputFile) throws ResizeException {
2.14 File inputFileRelative = relativize(options.getInput(), inputFile);
2.15 log.log(Level.FINER, "Resizing file: {0}", inputFileRelative);
2.16 + counters.increment(Counters.COUNTER_TYPE.FILES);
2.17
2.18 ImageFormat format = ImageFormat.getMatching(inputFile.getName());
2.19
2.20 if (format == null) {
2.21 log.log(Level.FINER, "Skipping file: {0} (no image format matched this extension)", inputFileRelative);
2.22 + counters.increment(Counters.COUNTER_TYPE.SKIPPED_UNKNOWN_EXTENSION);
2.23 } else {
2.24 try {
2.25 for (SizeSpecification size : options.getSizes()) {
2.26 @@ -71,10 +73,12 @@
2.27 if (shouldResize(image, size)) {
2.28 try (FileOutputStream output = new FileOutputStream(outputFile)) {
2.29 resizer.resize(image, output, size, format);
2.30 + counters.increment(Counters.COUNTER_TYPE.RESIZED);
2.31 }
2.32 } else {
2.33 log.log(Level.FINER, "File: {0} has already required (or smaller) size → just copy", inputFileRelative);
2.34 justCopy(inputFile, outputFile);
2.35 + counters.increment(Counters.COUNTER_TYPE.JUST_COPIED);
2.36 }
2.37 }
2.38 }
2.39 @@ -124,6 +128,7 @@
2.40 private void resizeDirectory(File directory) throws ResizeException {
2.41
2.42 log.log(Level.FINE, "Resizing directory: {0}", directory);
2.43 + counters.increment(Counters.COUNTER_TYPE.DIRECTORIES);
2.44
2.45 for (SizeSpecification size : options.getSizes()) {
2.46 File relative = relativize(options.getInput(), directory);