CBZ: fix meta for non-images documents
authorNiki Roo <niki@nikiroo.be>
Fri, 23 Mar 2018 13:54:30 +0000 (14:54 +0100)
committerNiki Roo <niki@nikiroo.be>
Fri, 23 Mar 2018 13:54:30 +0000 (14:54 +0100)
src/be/nikiroo/fanfix/supported/Cbz.java
src/be/nikiroo/fanfix/supported/Epub.java
src/be/nikiroo/fanfix/test/ConversionTest.java

index b6524acac90fbb16d3ffd6e7621c84c4f518883a..8ab2a5202044ec850bcb29b979bdec0f0483fd17 100644 (file)
@@ -1,7 +1,6 @@
 package be.nikiroo.fanfix.supported;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -46,14 +45,13 @@ class Cbz extends Epub {
        }
 
        @Override
-       protected boolean getCover() {
-               return false;
+       protected boolean isImagesDocumentByDefault() {
+               return true;
        }
 
        @Override
-       protected void preprocess(URL source, InputStream in) throws IOException {
-               super.preprocess(source, in);
-               meta.setImageDocument(true);
+       protected boolean getCover() {
+               return false;
        }
 
        @Override
index 9b06f202f965e82782f3acf98607d9bf6c37ac65..8ae4c6c37052c5569674804b3be5d4fa3244f343 100644 (file)
@@ -196,6 +196,7 @@ class Epub extends InfoText {
                        meta.setUrl(url);
                        meta.setTitle(title);
                        meta.setAuthor(author);
+                       meta.setImageDocument(isImagesDocumentByDefault());
                }
        }
 
@@ -231,4 +232,8 @@ class Epub extends InfoText {
        protected boolean getCover() {
                return true;
        }
+
+       protected boolean isImagesDocumentByDefault() {
+               return false;
+       }
 }
index 54d08858fa3b087cdae553f4523518a7fb089592..07ec7478006a1ea1c4487d11c4f0e99cd01ff074 100644 (file)
@@ -235,6 +235,7 @@ class ConversionTest extends TestLauncher {
                }
        }
 
+       // TODO: remove and use IOUtils when updated
        private static void unzip(File zipFile, File targetDirectory)
                        throws IOException {
                if (targetDirectory.exists() && targetDirectory.isFile()) {