From 585ae2b8eb73f844fff4205fab2d4625830bec54 Mon Sep 17 00:00:00 2001 From: Niki Date: Fri, 22 Mar 2019 15:48:18 +0100 Subject: [PATCH] fix cache getStory --- .../nikiroo/fanfix/library/CacheLibrary.java | 7 +------ .../nikiroo/fanfix/library/LocalLibrary.java | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) 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 -- 2.27.0