From: Niki Roo Date: Thu, 14 May 2020 12:27:17 +0000 (+0200) Subject: weblib: update pg on import X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=96e252e06064085d08e80870f8d8942348fa3c9a;p=fanfix.git weblib: update pg on import --- diff --git a/src/be/nikiroo/fanfix/data/MetaData.java b/src/be/nikiroo/fanfix/data/MetaData.java index 586196a..bcebf75 100644 --- a/src/be/nikiroo/fanfix/data/MetaData.java +++ b/src/be/nikiroo/fanfix/data/MetaData.java @@ -34,6 +34,12 @@ public class MetaData implements Cloneable, Comparable, Serializable { private String creationDate; private boolean fakeCover; + /** + * Create an empty {@link MetaData}. + */ + public MetaData() { + } + /** * The title of the story. * @@ -479,8 +485,9 @@ public class MetaData implements Cloneable, Comparable, Serializable { } return String.format( - "Meta %s:\n\tTitle: [%s]\n\tAuthor: [%s]\n\tDate: [%s]\n\tTags: [%s]" - + "\n\tResume: [%s]\n\tCover: [%s]", luid, title, - getAuthor(), getDate(), tags.toString(), resume, cover); + "Meta %s:\n\tTitle: [%s]\n\tAuthor: [%s]\n\tDate: [%s]\n\tTags: [%s]\n\tWord count: [%s]" + + "\n\tResume: [%s]\n\tCover: [%s]", + luid, title, getAuthor(), getDate(), tags.toString(), + "" + words, resume, cover); } } diff --git a/src/be/nikiroo/fanfix/library/WebLibraryServer.java b/src/be/nikiroo/fanfix/library/WebLibraryServer.java index 9073b8c..b3d897d 100644 --- a/src/be/nikiroo/fanfix/library/WebLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/WebLibraryServer.java @@ -28,6 +28,7 @@ import be.nikiroo.utils.NanoHTTPD; import be.nikiroo.utils.NanoHTTPD.Response; import be.nikiroo.utils.NanoHTTPD.Response.Status; import be.nikiroo.utils.Progress; +import be.nikiroo.utils.Progress.ProgressListener; public class WebLibraryServer extends WebLibraryServerHtml { class WLoginResult extends LoginResult { @@ -414,6 +415,14 @@ public class WebLibraryServer extends WebLibraryServerHtml { final Progress pg = new Progress(); final String luid = lib.getNextId(); + // Keep the latest name + pg.addProgressListener(new ProgressListener() { + @Override + public void progress(Progress progress, String name) { + pg.setName(name); + } + }); + synchronized (imprts) { imprts.put(luid, pg); }