From 2d2a32227e37cb3be9c2b2259d1673f2dc0dc1cd Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Tue, 18 Apr 2017 21:37:52 +0200 Subject: [PATCH] When cover not found, check next to .info --- src/be/nikiroo/fanfix/supported/InfoReader.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/be/nikiroo/fanfix/supported/InfoReader.java b/src/be/nikiroo/fanfix/supported/InfoReader.java index ede84e3..571f77b 100644 --- a/src/be/nikiroo/fanfix/supported/InfoReader.java +++ b/src/be/nikiroo/fanfix/supported/InfoReader.java @@ -9,6 +9,8 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; +import be.nikiroo.fanfix.Instance; +import be.nikiroo.fanfix.bundles.Config; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.utils.MarkableFileInputStream; @@ -56,6 +58,18 @@ public class InfoReader { if (withCover) { meta.setCover(BasicSupport.getImage(null, sourceInfoFile, getInfoTag(in, "COVER"))); + // 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); + meta.setCover(BasicSupport.getImage(null, sourceInfoFile, + info + ext)); + } + } } try { meta.setWords(Long.parseLong(getInfoTag(in, "WORDCOUNT"))); -- 2.27.0