fix remote default covers
authorNiki Roo <niki@nikiroo.be>
Sat, 16 Mar 2019 21:21:10 +0000 (22:21 +0100)
committerNiki Roo <niki@nikiroo.be>
Sat, 16 Mar 2019 21:21:10 +0000 (22:21 +0100)
src/be/nikiroo/fanfix/library/CacheLibrary.java
src/be/nikiroo/fanfix/library/LocalLibrary.java

index c8721ddae3719cae169e00112efc1308d76177a1..a550740bafa7a9105d271ef9dd7df53515651d6e 100644 (file)
@@ -117,7 +117,12 @@ public class CacheLibrary extends BasicLibrary {
                        return custom;
                }
 
-               return cacheLib.getSourceCover(source);
+               Image cached = cacheLib.getSourceCover(source);
+               if (cached != null) {
+                       return cached;
+               }
+
+               return lib.getSourceCover(source);
        }
 
        @Override
index 93bf7ba2f995cff5f12e74f109d648f0c72f603c..eafd18a6ecf642317c9e35c1e8e1c25aeea0ec5b 100644 (file)
@@ -265,7 +265,9 @@ public class LocalLibrary extends BasicLibrary {
         *            the cover image
         */
        synchronized void setSourceCover(String source, Image coverImage) {
-               File cover = new File(getExpectedDir(source), ".cover");
+               File dir = getExpectedDir(source);
+               dir.mkdirs();
+               File cover = new File(dir, ".cover");
                try {
                        Instance.getCache().saveAsImage(coverImage, cover, true);
                        if (sourceCovers != null) {