X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FBasicLibrary.java;h=129c8fb33b1fc764c18a28661c3d45216b724f21;hb=9b863b20370118c95c6801b73dda951c7e507871;hp=e62416bcca9fd1112bbf8ade0175dc008dcd142d;hpb=0bf8264eecb834dd7ca75d30db0980bcb825284b;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index e62416b..129c8fb 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -355,8 +355,7 @@ abstract public class BasicLibrary { if (type != null) { story = BasicSupport.getSupport(type, url) // .process(pgProcess); - System.out.println("orig meta: "+meta); - System.out.println("story retrieved: "+story); + // Because we do not want to clear the meta cache: meta.setCover(story.getMeta().getCover()); story.setMeta(meta); @@ -399,12 +398,24 @@ abstract public class BasicLibrary { * in case of I/O error */ public Story imprt(URL url, Progress pg) throws IOException { + if (pg == null) + pg = new Progress(); + + pg.setMinMax(0, 1000); + Progress pgProcess = new Progress(); + Progress pgSave = new Progress(); + pg.addProgress(pgProcess, 800); + pg.addProgress(pgSave, 200); + BasicSupport support = BasicSupport.getSupport(url); if (support == null) { throw new UnknownHostException("" + url); } - return save(support.process(pg), null); + Story story = save(support.process(pgProcess), pgSave); + pg.done(); + + return story; } /** @@ -520,6 +531,9 @@ abstract public class BasicLibrary { public synchronized Story save(Story story, String luid, Progress pg) throws IOException { + Instance.getTraceHandler().trace( + this.getClass().getSimpleName() + ": saving story " + luid); + // Do not change the original metadata, but change the original story MetaData meta = story.getMeta().clone(); story.setMeta(meta); @@ -538,6 +552,10 @@ abstract public class BasicLibrary { updateInfo(story.getMeta()); + Instance.getTraceHandler().trace( + this.getClass().getSimpleName() + ": story saved (" + luid + + ")"); + return story; } @@ -551,8 +569,15 @@ abstract public class BasicLibrary { * in case of I/O error */ public synchronized void delete(String luid) throws IOException { + Instance.getTraceHandler().trace( + this.getClass().getSimpleName() + ": deleting story " + luid); + doDelete(luid); deleteInfo(luid); + + Instance.getTraceHandler().trace( + this.getClass().getSimpleName() + ": story deleted (" + luid + + ")"); } /**