X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FLocalLibrary.java;h=25f2ec960627ab354295289f73a7c93d6bbbe3ed;hb=cfdaf6052ddc5ca44cf19f1f6d9f154cc8443024;hp=7220a3951de137f99a4a11ecc7e5f5b119abb3c1;hpb=e247c76b6ae8c21b9d4af979b972140e9283dfbe;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 7220a39..25f2ec9 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -254,7 +254,13 @@ public class LocalLibrary extends BasicLibrary { in = new FileInputStream(cover); try { synchronized (lock) { - sourceCovers.put(source, new Image(in)); + Image img = new Image(in); + if (img.getSize() == 0) { + img.close(); + throw new IOException( + "Empty image not accepted"); + } + sourceCovers.put(source, img); } } finally { in.close(); @@ -298,7 +304,13 @@ public class LocalLibrary extends BasicLibrary { in = new FileInputStream(cover); try { synchronized (lock) { - authorCovers.put(author, new Image(in)); + Image img = new Image(in); + if (img.getSize() == 0) { + img.close(); + throw new IOException( + "Empty image not accepted"); + } + authorCovers.put(author, img); } } finally { in.close(); @@ -613,6 +625,18 @@ public class LocalLibrary extends BasicLibrary { files.add(coverFile); } + String summaryExt = ".summary"; + File summaryFile = new File(path + summaryExt); + if (!summaryFile.exists()) { + summaryFile = new File( + path.substring(0, path.length() - fileExt.length()) + + summaryExt); + } + + if (summaryFile.exists()) { + files.add(summaryFile); + } + return files; }