cover: allow custom author covers
[fanfix.git] / src / be / nikiroo / fanfix / library / CacheLibrary.java
index 918b763ff376b9a07075aceb41bff4023936f5e5..0f283183b620006188040d0e59c84b3025e7f9e7 100644 (file)
@@ -125,6 +125,22 @@ public class CacheLibrary extends BasicLibrary {
                return lib.getSourceCover(source);
        }
 
+       @Override
+       public Image getAuthorCover(String author) {
+               Image custom = getCustomSourceCover(author);
+               if (custom != null) {
+                       return custom;
+               }
+
+               Image cached = cacheLib.getSourceCover(author);
+               if (cached != null) {
+                       return cached;
+               }
+
+               return lib.getSourceCover(author);
+
+       }
+
        @Override
        public Image getCustomSourceCover(String source) {
                Image custom = cacheLib.getCustomSourceCover(source);
@@ -137,6 +153,19 @@ public class CacheLibrary extends BasicLibrary {
 
                return custom;
        }
+       
+       @Override
+       public Image getCustomAuthorCover(String author) {
+               Image custom = cacheLib.getCustomAuthorCover(author);
+               if (custom == null) {
+                       custom = lib.getCustomAuthorCover(author);
+                       if (custom != null) {
+                               cacheLib.setAuthorCover(author, custom);
+                       }
+               }
+
+               return custom;
+       }
 
        @Override
        public void setSourceCover(String source, String luid) {
@@ -144,6 +173,12 @@ public class CacheLibrary extends BasicLibrary {
                cacheLib.setSourceCover(source, getCover(luid));
        }
 
+       @Override
+       public void setAuthorCover(String author, String luid) {
+               lib.setAuthorCover(author, luid);
+               cacheLib.setAuthorCover(author, getCover(luid));
+       }
+
        @Override
        protected void updateInfo(MetaData meta) {
                if (meta != null && metas != null) {