From: Niki Roo Date: Sun, 24 Mar 2019 17:16:20 +0000 (+0100) Subject: reader: fix meta desc X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=a98e49ee84dee80fe122d9cac03b1ae20c31a54c;p=nikiroo-utils.git reader: fix meta desc --- diff --git a/src/be/nikiroo/fanfix/reader/BasicReader.java b/src/be/nikiroo/fanfix/reader/BasicReader.java index 63c34b0..c2a650c 100644 --- a/src/be/nikiroo/fanfix/reader/BasicReader.java +++ b/src/be/nikiroo/fanfix/reader/BasicReader.java @@ -231,7 +231,11 @@ public abstract class BasicReader implements Reader { metaDesc.put("Publication date", formatDate(meta.getDate())); metaDesc.put("Published on", meta.getPublisher()); metaDesc.put("URL", meta.getUrl()); - metaDesc.put("Word count", format(meta.getWords())); + if (meta.isImageDocument()) { + metaDesc.put("Number of images", format(meta.getWords())); + } else { + metaDesc.put("Number of words", format(meta.getWords())); + } metaDesc.put("Source", meta.getSource()); metaDesc.put("Subject", meta.getSubject()); metaDesc.put("Language", meta.getLang()); @@ -349,6 +353,12 @@ public abstract class BasicReader implements Reader { static private String format(long value) { String display = ""; + String suffix = ""; + + if (value > 4000) { + value = value / 1000; + suffix = "k"; + } while (value > 0) { if (!display.isEmpty()) { @@ -358,7 +368,7 @@ public abstract class BasicReader implements Reader { value = value / 1000; } - return display; + return display + suffix; } static private String formatDate(String date) {