From: Niki Roo Date: Sat, 16 Mar 2019 21:21:10 +0000 (+0100) Subject: fix remote default covers X-Git-Tag: fanfix-swing-0.0.1~12^2~245 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=cf45a4c44b472d0e1bbbcbc9891020366e99364c;p=fanfix-swing.git fix remote default covers --- diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index c8721dda..a550740b 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -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 diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 93bf7ba2..eafd18a6 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -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) {