From: Niki Date: Fri, 22 Mar 2019 14:48:18 +0000 (+0100) Subject: fix cache getStory X-Git-Tag: fanfix-2.0.0~11 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=585ae2b8eb73f844fff4205fab2d4625830bec54;p=fanfix.git fix cache getStory --- diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index ea1fd70..74af1b6 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -67,12 +67,7 @@ public class CacheLibrary extends BasicLibrary { @Override public synchronized Story getStory(String luid, MetaData meta, Progress pg) { - String normal = Instance.getUiConfig().getString( - UiConfig.GUI_NON_IMAGES_DOCUMENT_TYPE); - String images = Instance.getUiConfig().getString( - UiConfig.GUI_IMAGES_DOCUMENT_TYPE); - String type = meta.isImageDocument() ? images : normal; - + String type = cacheLib.getOutputType(meta.isImageDocument()); MetaData cachedMeta = meta.clone(); cachedMeta.setType(type); diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index d0bf61a..bd9fe07 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -410,9 +410,25 @@ public class LocalLibrary extends BasicLibrary { if (meta != null && meta.isImageDocument()) { return image; } - + return text; } + + /** + * Return the default {@link OutputType} for this kind of {@link Story}. + * + * @param imageDocument + * TRUE for images document, FALSE for text documents + * + * @return the type + */ + public String getOutputType(boolean imageDocument) { + if (imageDocument) { + return image.toString(); + } + + return text.toString(); + } /** * Get the target {@link File} related to the given .info