From a98e49ee84dee80fe122d9cac03b1ae20c31a54c Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 24 Mar 2019 18:16:20 +0100 Subject: [PATCH] reader: fix meta desc --- src/be/nikiroo/fanfix/reader/BasicReader.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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) { -- 2.27.0