fix custom author covers
authorNiki Roo <niki@nikiroo.be>
Wed, 20 Mar 2019 22:34:23 +0000 (23:34 +0100)
committerNiki Roo <niki@nikiroo.be>
Wed, 20 Mar 2019 22:34:23 +0000 (23:34 +0100)
src/be/nikiroo/fanfix/library/CacheLibrary.java
src/be/nikiroo/fanfix/library/LocalLibrary.java

index 0f283183b620006188040d0e59c84b3025e7f9e7..9432b33f5a0fb0b46fa360e3ca882fe3386bb87e 100644 (file)
@@ -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);
index 1752dc7f3e253e57586fdc0e675d380700bc31ee..90e10c3024a61949762fe6a95fb30b5472e0f54c 100644 (file)
@@ -255,6 +255,15 @@ public class LocalLibrary extends BasicLibrary {
 
        @Override
        public synchronized Image getCustomAuthorCover(String author) {
+               if (authorCovers == null) {
+                       authorCovers = new HashMap<String, Image>();
+               }
+
+               Image img = authorCovers.get(author);
+               if (img != null) {
+                       return img;
+               }
+
                File cover = getAuthorCoverFile(author);
                if (cover.exists()) {
                        InputStream in;