fix cache getStory
authorNiki <david.roulet@uclouvain.be>
Fri, 22 Mar 2019 14:48:18 +0000 (15:48 +0100)
committerNiki <david.roulet@uclouvain.be>
Fri, 22 Mar 2019 14:48:18 +0000 (15:48 +0100)
src/be/nikiroo/fanfix/library/CacheLibrary.java
src/be/nikiroo/fanfix/library/LocalLibrary.java

index ea1fd707913ba0b6696e732a64f38cc3d9cfcdbc..74af1b682c3ac21a982a7af0407b7e58edb322c4 100644 (file)
@@ -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);
 
index d0bf61a44b30453f0972bb3c6c9b99d2588df161..bd9fe07cf7d720aae04cb04da884695e9a01e41d 100644 (file)
@@ -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 <tt>.info</tt>