From: Niki Roo Date: Wed, 20 Mar 2019 22:34:23 +0000 (+0100) Subject: fix custom author covers X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=c956ff52ac789f80c9b694a8f74ca8f1f47db67c;p=fanfix-jexer.git fix custom author covers --- diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index 0f28318..9432b33 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -127,18 +127,17 @@ public class CacheLibrary extends BasicLibrary { @Override public Image getAuthorCover(String author) { - Image custom = getCustomSourceCover(author); + Image custom = getCustomAuthorCover(author); if (custom != null) { return custom; } - Image cached = cacheLib.getSourceCover(author); + Image cached = cacheLib.getAuthorCover(author); if (cached != null) { return cached; } - return lib.getSourceCover(author); - + return lib.getAuthorCover(author); } @Override @@ -153,7 +152,7 @@ public class CacheLibrary extends BasicLibrary { return custom; } - + @Override public Image getCustomAuthorCover(String author) { Image custom = cacheLib.getCustomAuthorCover(author); diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 1752dc7..90e10c3 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;