X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FLocalLibrary.java;h=bd9fe07cf7d720aae04cb04da884695e9a01e41d;hb=32ba91e9d2443ac9d17d3db66eef4c570d02cdf1;hp=1752dc7f3e253e57586fdc0e675d380700bc31ee;hpb=3989dfc5ced262e3c8d07fc796ec06ce5513c6b8;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 1752dc7..bd9fe07 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -255,6 +255,15 @@ public class LocalLibrary extends BasicLibrary { @Override public synchronized Image getCustomAuthorCover(String author) { + if (authorCovers == null) { + authorCovers = new HashMap(); + } + + Image img = authorCovers.get(author); + if (img != null) { + return img; + } + File cover = getAuthorCoverFile(author); if (cover.exists()) { InputStream in; @@ -401,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 @@ -614,7 +639,8 @@ public class LocalLibrary extends BasicLibrary { boolean info = file != null && file.isFile() && file.getPath().toLowerCase().endsWith(".info"); boolean dir = file != null && file.isDirectory(); - return info || dir; + boolean isExpandedHtml = new File(file, "index.html").isFile(); + return info || (dir && !isExpandedHtml); } });