fix remote default covers
[fanfix.git] / src / be / nikiroo / fanfix / library / LocalLibrary.java
index 50f9ac01fe902f272255e96da1facbd117a85178..eafd18a6ecf642317c9e35c1e8e1c25aeea0ec5b 100644 (file)
@@ -123,6 +123,10 @@ public class LocalLibrary extends BasicLibrary {
        public Image getCover(String luid) {
                MetaData meta = getInfo(luid);
                if (meta != null) {
+                       if (meta.getCover() != null) {
+                               return meta.getCover();
+                       }
+
                        File[] files = getStories(null).get(meta);
                        if (files != null) {
                                File infoFile = files[0];
@@ -261,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) {