From c956ff52ac789f80c9b694a8f74ca8f1f47db67c Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 20 Mar 2019 23:34:23 +0100 Subject: [PATCH] fix custom author covers --- src/be/nikiroo/fanfix/library/CacheLibrary.java | 9 ++++----- src/be/nikiroo/fanfix/library/LocalLibrary.java | 9 +++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) 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; -- 2.27.0