fix DataLoader (!)
authorNiki Roo <niki@nikiroo.be>
Sun, 12 May 2019 14:52:30 +0000 (16:52 +0200)
committerNiki Roo <niki@nikiroo.be>
Sun, 12 May 2019 14:52:30 +0000 (16:52 +0200)
src/be/nikiroo/fanfix/DataLoader.java
src/be/nikiroo/fanfix/data/MetaData.java
src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java
src/be/nikiroo/fanfix/supported/Cbz.java

index 51855c418d6ea8b7f5973a3dd1c16b6684515e8f..abc958501a9fcf04e80be952de2c8ec92e59b6b9 100644 (file)
@@ -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();
                }
        }
index 67fedbd35627a5da59968fe92e13b21533cae869..1781d869f263c559d6e7f5240399db5e498a4fd5 100644 (file)
@@ -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<MetaData>, 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(
index f8ea9d469570cfd4a1a63148b6167bfdf028ac44..d1dbc00b4595d3517f20f4cd0a50dc449b4cfc36 100644 (file)
@@ -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 {
index 3da65ee728406b0cc21c3e69c425601d700f109e..3682afe520706748c36e1132cf56770d02c919bb 100644 (file)
@@ -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,