X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FInfoReader.java;h=b65256ca4b6a3a4db4e836113fe064587be35fbf;hb=16a81ef7656c5c692fb831927e75edde25dd77a0;hp=571f77b0a1cda5b08e6e775b257d9db8f27eb101;hpb=2d2a32227e37cb3be9c2b2259d1673f2dc0dc1cd;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/supported/InfoReader.java b/src/be/nikiroo/fanfix/supported/InfoReader.java index 571f77b..b65256c 100644 --- a/src/be/nikiroo/fanfix/supported/InfoReader.java +++ b/src/be/nikiroo/fanfix/supported/InfoReader.java @@ -31,11 +31,11 @@ public class InfoReader { in.close(); in = null; } - } else { - throw new FileNotFoundException( - "File given as argument does not exists: " - + infoFile.getAbsolutePath()); } + + throw new FileNotFoundException( + "File given as argument does not exists: " + + infoFile.getAbsolutePath()); } private static MetaData createMeta(URL sourceInfoFile, InputStream in, @@ -56,16 +56,20 @@ public class InfoReader { meta.setType(getInfoTag(in, "TYPE")); meta.setImageDocument(getInfoTagBoolean(in, "IMAGES_DOCUMENT", false)); if (withCover) { - meta.setCover(BasicSupport.getImage(null, sourceInfoFile, - getInfoTag(in, "COVER"))); + String infoTag = getInfoTag(in, "COVER"); + if (infoTag != null && !infoTag.trim().isEmpty()) { + meta.setCover(BasicSupport.getImage(null, sourceInfoFile, + infoTag)); + } // Second chance: try to check for a cover next to the info file if (meta.getCover() == null) { String info = sourceInfoFile.getFile().toString(); if (info.endsWith(".info")) { info = info.substring(0, info.length() - ".info".length()); String ext = "." - + Instance.getConfig().getString( - Config.IMAGE_FORMAT_COVER); + + Instance.getConfig() + .getString(Config.IMAGE_FORMAT_COVER) + .toLowerCase(); meta.setCover(BasicSupport.getImage(null, sourceInfoFile, info + ext)); }