Remote: fix missing cover (try 1)
[nikiroo-utils.git] / src / be / nikiroo / fanfix / library / LocalLibrary.java
index 4cdfb944e0cd7b62bdbdedadac580cefa61f895b..54ad1d66769d8962cf5516a2bc5c6302e04e0ac6 100644 (file)
@@ -20,7 +20,6 @@ import be.nikiroo.fanfix.output.InfoCover;
 import be.nikiroo.fanfix.supported.InfoReader;
 import be.nikiroo.utils.IOUtils;
 import be.nikiroo.utils.Image;
-import be.nikiroo.utils.MarkableFileInputStream;
 import be.nikiroo.utils.Progress;
 
 /**
@@ -128,7 +127,12 @@ public class LocalLibrary extends BasicLibrary {
        }
 
        @Override
-       protected void invalidateInfo(String luid) {
+       protected synchronized void updateInfo(MetaData meta) {
+               deleteInfo();
+       }
+
+       @Override
+       protected void deleteInfo(String luid) {
                stories = null;
                sourceCovers = new HashMap<String, Image>();
        }
@@ -190,7 +194,7 @@ public class LocalLibrary extends BasicLibrary {
                        }
                }
 
-               invalidateInfo();
+               deleteInfo();
        }
 
        @Override
@@ -205,7 +209,7 @@ public class LocalLibrary extends BasicLibrary {
        @Override
        public void setSourceCover(String source, String luid) {
                sourceCovers.put(source, getCover(luid));
-               File cover = new File(getExpectedDir(source), ".cover.png");
+               File cover = new File(getExpectedDir(source), ".cover");
                try {
                        Instance.getCache().saveAsImage(sourceCovers.get(source), cover,
                                        true);
@@ -262,7 +266,7 @@ public class LocalLibrary extends BasicLibrary {
                                        pg.add(1);
                                }
 
-                               invalidateInfo();
+                               deleteInfo();
                                pg.done();
                                return;
                        }
@@ -270,7 +274,7 @@ public class LocalLibrary extends BasicLibrary {
 
                super.imprt(other, luid, pg);
 
-               invalidateInfo();
+               deleteInfo();
        }
 
        /**
@@ -405,7 +409,7 @@ public class LocalLibrary extends BasicLibrary {
         * {@link LocalLibrary#baseDir}.
         * <p>
         * Will use a cached list when possible (see
-        * {@link BasicLibrary#invalidateInfo()}).
+        * {@link BasicLibrary#deleteInfo()}).
         * 
         * @param pg
         *            the optional {@link Progress}
@@ -468,10 +472,8 @@ public class LocalLibrary extends BasicLibrary {
                                                                // not normal!!
                                                                throw new IOException(
                                                                                "Cannot understand the LUID of "
-                                                                                               + infoFile
-                                                                                               + ": "
-                                                                                               + (meta == null ? "[meta is NULL]"
-                                                                                                               : meta.getLuid()), e);
+                                                                                               + infoFile + ": "
+                                                                                               + meta.getLuid(), e);
                                                        }
                                                } catch (IOException e) {
                                                        // We should not have not-supported files in the
@@ -519,7 +521,7 @@ public class LocalLibrary extends BasicLibrary {
         */
        void setSourceCover(String source, Image coverImage) {
                sourceCovers.put(source, coverImage);
-               File cover = new File(getExpectedDir(source), ".cover.png");
+               File cover = new File(getExpectedDir(source), ".cover");
                try {
                        Instance.getCache().saveAsImage(sourceCovers.get(source), cover,
                                        true);