Update nikiroo-utils, Remote:
[fanfix.git] / src / be / nikiroo / fanfix / library / CacheLibrary.java
index 28f568210bbcf137a1690989cad15fac50ae72e7..14113e4a583be24b5ea2a5ba71b04810220255c6 100644 (file)
@@ -3,6 +3,7 @@ package be.nikiroo.fanfix.library;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
 import java.util.List;
 
 import be.nikiroo.fanfix.Instance;
@@ -101,6 +102,7 @@ public class CacheLibrary extends BasicLibrary {
 
        @Override
        public BufferedImage getCover(final String luid) {
+               // TODO: cache doesn't seem to work
                if (isCached(luid)) {
                        return cacheLib.getCover(luid);
                }
@@ -211,6 +213,25 @@ public class CacheLibrary extends BasicLibrary {
                }
        }
 
+       @Override
+       public Story imprt(URL url, Progress pg) throws IOException {
+               if (pg == null) {
+                       pg = new Progress();
+               }
+
+               Progress pgImprt = new Progress();
+               Progress pgCache = new Progress();
+               pg.setMinMax(0, 10);
+               pg.addProgress(pgImprt, 7);
+               pg.addProgress(pgCache, 3);
+
+               Story story = lib.imprt(url, pgImprt);
+               cacheLib.save(story, story.getMeta().getLuid(), pgCache);
+
+               pg.done();
+               return story;
+       }
+
        // All the following methods are only used by Save and Delete in
        // BasicLibrary: