From c289a297c0e819c9c944732e52e30a35db7a1796 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 12 May 2019 16:52:30 +0200 Subject: [PATCH] fix DataLoader (!) --- src/be/nikiroo/fanfix/DataLoader.java | 2 +- src/be/nikiroo/fanfix/data/MetaData.java | 16 +++------------- .../supported/BasicSupport_Deprecated.java | 1 - src/be/nikiroo/fanfix/supported/Cbz.java | 3 +-- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/be/nikiroo/fanfix/DataLoader.java b/src/be/nikiroo/fanfix/DataLoader.java index 51855c41..abc95850 100644 --- a/src/be/nikiroo/fanfix/DataLoader.java +++ b/src/be/nikiroo/fanfix/DataLoader.java @@ -238,7 +238,7 @@ public class DataLoader { */ public void refresh(URL url, BasicSupport support, boolean stable) throws IOException { - if (check(url, stable)) { + if (!check(url, stable)) { open(url, url, support, stable, null, null, null).close(); } } diff --git a/src/be/nikiroo/fanfix/data/MetaData.java b/src/be/nikiroo/fanfix/data/MetaData.java index 67fedbd3..1781d869 100644 --- a/src/be/nikiroo/fanfix/data/MetaData.java +++ b/src/be/nikiroo/fanfix/data/MetaData.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import be.nikiroo.utils.Image; +import be.nikiroo.utils.StringUtils; /** * The meta data associated to a {@link Story} object. @@ -469,19 +470,8 @@ public class MetaData implements Cloneable, Comparable, Serializable { String cover = "none"; if (getCover() != null) { - cover = " bytes"; - - int size = getCover().getData().length; - if (size > 1000) { - size /= 1000; - cover = " kb"; - if (size > 1000) { - size /= 1000; - cover = " mb"; - } - } - - cover = size + cover; + cover = StringUtils.formatNumber(getCover().getData().length) + + "bytes"; } return String.format( diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java b/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java index f8ea9d46..d1dbc00b 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java @@ -681,7 +681,6 @@ public abstract class BasicSupport_Deprecated extends BasicSupport { // try for files if (source != null) { try { - String relPath = null; String absPath = null; try { diff --git a/src/be/nikiroo/fanfix/supported/Cbz.java b/src/be/nikiroo/fanfix/supported/Cbz.java index 3da65ee7..3682afe5 100644 --- a/src/be/nikiroo/fanfix/supported/Cbz.java +++ b/src/be/nikiroo/fanfix/supported/Cbz.java @@ -1,7 +1,6 @@ package be.nikiroo.fanfix.supported; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -21,8 +20,8 @@ import be.nikiroo.fanfix.data.Paragraph.ParagraphType; import be.nikiroo.fanfix.data.Story; import be.nikiroo.utils.IOUtils; import be.nikiroo.utils.Image; -import be.nikiroo.utils.streams.MarkableFileInputStream; import be.nikiroo.utils.Progress; +import be.nikiroo.utils.streams.MarkableFileInputStream; /** * Support class for CBZ files (works better with CBZ created with this program, -- 2.27.0