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;
return lib.getLibraryName();
}
+ @Override
+ public Status getStatus() {
+ return lib.getStatus();
+ }
+
@Override
protected List<MetaData> getMetas(Progress pg) {
if (pg == null) {
@Override
public BufferedImage getCover(final String luid) {
+ // TODO: cache doesn't seem to work
if (isCached(luid)) {
return cacheLib.getCover(luid);
}
@Override
public synchronized Story save(Story story, String luid, Progress pg)
throws IOException {
- story = lib.save(story, luid, pg);
+ Progress pgLib = new Progress();
+ Progress pgCacheLib = new Progress();
+
+ if (pg == null) {
+ pg = new Progress();
+ }
+
+ pg.setMinMax(0, 2);
+ pg.addProgress(pgLib, 1);
+ pg.addProgress(pgCacheLib, 1);
+
+ story = lib.save(story, luid, pgLib);
+ story = cacheLib.save(story, story.getMeta().getLuid(), pgCacheLib);
+
clearCache();
+
return story;
}
}
}
+ @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: