X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FCbz.java;h=3da65ee728406b0cc21c3e69c425601d700f109e;hb=654e27bb90879440335f265b69e2a3a5fb085eb2;hp=062adf0fac71550a8946257f9123e2d178ba7d98;hpb=e5a2f1b3d64907292ef59c6eae076354510e8641;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/Cbz.java b/src/be/nikiroo/fanfix/supported/Cbz.java index 062adf0..3da65ee 100644 --- a/src/be/nikiroo/fanfix/supported/Cbz.java +++ b/src/be/nikiroo/fanfix/supported/Cbz.java @@ -21,7 +21,7 @@ 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.MarkableFileInputStream; +import be.nikiroo.utils.streams.MarkableFileInputStream; import be.nikiroo.utils.Progress; /** @@ -36,11 +36,6 @@ class Cbz extends Epub { return url.toString().toLowerCase().endsWith(".cbz"); } - @Override - public String getSourceName() { - return "cbz"; - } - @Override protected String getDataPrefix() { return ""; @@ -83,8 +78,7 @@ class Cbz extends Epub { InputStream cbzIn = null; ZipInputStream zipIn = null; try { - cbzIn = new MarkableFileInputStream(new FileInputStream( - getSourceFileOriginal())); + cbzIn = new MarkableFileInputStream(getSourceFileOriginal()); zipIn = new ZipInputStream(cbzIn); for (ZipEntry entry = zipIn.getNextEntry(); entry != null; entry = zipIn .getNextEntry()) { @@ -138,25 +132,27 @@ class Cbz extends Epub { story.setChapters(new ArrayList()); // Check if we can find non-images chapters, for hybrid-cbz support - for (Chapter chap : origStory) { - Boolean isImages = null; - for (Paragraph para : chap) { - ParagraphType t = para.getType(); - if (isImages == null && !t.isText(true)) { - isImages = true; - } - if (t.isText(false)) { - String line = para.getContent(); - // Images are saved in text mode as "[image-link]" - if (!(line.startsWith("[") && line.endsWith("]"))) { - isImages = false; + if (origStory != null) { + for (Chapter chap : origStory) { + Boolean isImages = null; + for (Paragraph para : chap) { + ParagraphType t = para.getType(); + if (isImages == null && !t.isText(true)) { + isImages = true; + } + if (t.isText(false)) { + String line = para.getContent(); + // Images are saved in text mode as "[image-link]" + if (!(line.startsWith("[") && line.endsWith("]"))) { + isImages = false; + } } } - } - if (isImages != null && !isImages) { - story.getChapters().add(chap); - chap.setNumber(story.getChapters().size()); + if (isImages != null && !isImages) { + story.getChapters().add(chap); + chap.setNumber(story.getChapters().size()); + } } }