From e4fa48a0b617e0a5368e8e8589909ae93c340447 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Fri, 23 Mar 2018 14:54:30 +0100 Subject: [PATCH] CBZ: fix meta for non-images documents --- src/be/nikiroo/fanfix/supported/Cbz.java | 10 ++++------ src/be/nikiroo/fanfix/supported/Epub.java | 5 +++++ src/be/nikiroo/fanfix/test/ConversionTest.java | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/be/nikiroo/fanfix/supported/Cbz.java b/src/be/nikiroo/fanfix/supported/Cbz.java index b6524ac..8ab2a52 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.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 diff --git a/src/be/nikiroo/fanfix/supported/Epub.java b/src/be/nikiroo/fanfix/supported/Epub.java index 9b06f20..8ae4c6c 100644 --- a/src/be/nikiroo/fanfix/supported/Epub.java +++ b/src/be/nikiroo/fanfix/supported/Epub.java @@ -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; + } } diff --git a/src/be/nikiroo/fanfix/test/ConversionTest.java b/src/be/nikiroo/fanfix/test/ConversionTest.java index 54d0885..07ec747 100644 --- a/src/be/nikiroo/fanfix/test/ConversionTest.java +++ b/src/be/nikiroo/fanfix/test/ConversionTest.java @@ -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()) { -- 2.27.0