From b063fe0a74fdf17f440a850bbb98a2de6233a679 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 14 May 2020 15:18:10 +0200 Subject: [PATCH] update from master --- data/MetaData.java | 13 ++++++++++--- library/WebLibraryServer.java | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/data/MetaData.java b/data/MetaData.java index 586196a6..bcebf754 100644 --- a/data/MetaData.java +++ b/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/library/WebLibraryServer.java b/library/WebLibraryServer.java index 9073b8ca..b3d897d0 100644 --- a/library/WebLibraryServer.java +++ b/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