X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FCbz.java;h=8ab2a5202044ec850bcb29b979bdec0f0483fd17;hb=e4fa48a0b617e0a5368e8e8589909ae93c340447;hp=f67f28ae6f936af9235305b8c568e4ad8ed7310f;hpb=2a25f7814eec9854022f1c9dee188bfbdb955591;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/Cbz.java b/src/be/nikiroo/fanfix/supported/Cbz.java index f67f28a..8ab2a52 100644 --- a/src/be/nikiroo/fanfix/supported/Cbz.java +++ b/src/be/nikiroo/fanfix/supported/Cbz.java @@ -1,8 +1,6 @@ package be.nikiroo.fanfix.supported; -import java.awt.image.BufferedImage; import java.io.IOException; -import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Collections; @@ -16,7 +14,7 @@ import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.data.Chapter; import be.nikiroo.fanfix.data.Paragraph; import be.nikiroo.fanfix.data.Story; -import be.nikiroo.utils.ImageUtils; +import be.nikiroo.utils.Image; import be.nikiroo.utils.Progress; /** @@ -47,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 @@ -76,7 +73,7 @@ class Cbz extends Epub { ZipInputStream zipIn = new ZipInputStream(getInput()); - Map images = new HashMap(); + Map images = new HashMap(); for (ZipEntry entry = zipIn.getNextEntry(); entry != null; entry = zipIn .getNextEntry()) { if (!entry.isDirectory() @@ -92,7 +89,7 @@ class Cbz extends Epub { if (imageEntry) { String uuid = meta.getUuid() + "_" + entry.getName(); try { - images.put(uuid, ImageUtils.fromStream(zipIn)); + images.put(uuid, new Image(zipIn)); } catch (Exception e) { Instance.getTraceHandler().error(e); } @@ -122,6 +119,7 @@ class Cbz extends Epub { if (meta.getCover() == null && !images.isEmpty()) { meta.setCover(images.get(imagesList.get(0))); + meta.setFakeCover(true); } pg.setProgress(100);