From 96e252e06064085d08e80870f8d8942348fa3c9a Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 14 May 2020 14:27:17 +0200 Subject: [PATCH] weblib: update pg on import --- src/be/nikiroo/fanfix/data/MetaData.java | 13 ++++++++++--- src/be/nikiroo/fanfix/library/WebLibraryServer.java | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) 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); } -- 2.27.0