From: Niki Roo Date: Sat, 2 Dec 2017 14:03:51 +0000 (+0100) Subject: Fix cover file not sent over wire X-Git-Tag: fanfix-1.6.3~15 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=5083ef84efb7e001c0b5de235d3424e1b59c62f4;p=fanfix.git Fix cover file not sent over wire --- diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 66fb943..4c32e3c 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -319,15 +319,19 @@ abstract public class BasicLibrary { if (type != null) { story = BasicSupport.getSupport(type).process(url, pgProcess); + // Because we do not want to clear the meta cache: + meta.setCover(story.getMeta().getCover()); story.setMeta(meta); + // } else { throw new IOException("Unknown type: " + meta.getType()); } } catch (IOException e) { // We should not have not-supported files in the // library - Instance.getTraceHandler().error(new IOException( - "Cannot load file from library: " + file, e)); + Instance.getTraceHandler().error( + new IOException("Cannot load file from library: " + + file, e)); } finally { pgProcess.done(); pg.done(); diff --git a/src/be/nikiroo/fanfix/output/BasicOutput.java b/src/be/nikiroo/fanfix/output/BasicOutput.java index 036a156..30c2ac6 100644 --- a/src/be/nikiroo/fanfix/output/BasicOutput.java +++ b/src/be/nikiroo/fanfix/output/BasicOutput.java @@ -240,6 +240,25 @@ public abstract class BasicOutput { return type; } + /** + * Enable the creation of a .info file next to the resulting processed file. + * + * @return TRUE to enable it + */ + protected boolean isWriteInfo() { + return writeInfo; + } + + /** + * Enable the creation of a cover file next to the resulting processed file + * if possible. + * + * @return TRUE to enable it + */ + protected boolean isWriteCover() { + return writeCover; + } + /** * The output type. * diff --git a/src/be/nikiroo/fanfix/output/Cbz.java b/src/be/nikiroo/fanfix/output/Cbz.java index c70cc41..8853c76 100644 --- a/src/be/nikiroo/fanfix/output/Cbz.java +++ b/src/be/nikiroo/fanfix/output/Cbz.java @@ -27,7 +27,8 @@ class Cbz extends BasicOutput { dir.mkdir(); try { // will also save the images! - new InfoText().process(story, dir, targetNameOrig); + BasicOutput.getOutput(OutputType.TEXT, isWriteInfo()).process( + story, dir, targetNameOrig); InfoCover.writeInfo(dir, targetNameOrig, story.getMeta()); if (story.getMeta() != null && !story.getMeta().isFakeCover()) { diff --git a/src/be/nikiroo/fanfix/output/Epub.java b/src/be/nikiroo/fanfix/output/Epub.java index 2c47dcb..1ff6888 100644 --- a/src/be/nikiroo/fanfix/output/Epub.java +++ b/src/be/nikiroo/fanfix/output/Epub.java @@ -44,7 +44,8 @@ class Epub extends BasicOutput { // "Originals" File data = new File(tmpDir, "DATA"); data.mkdir(); - new InfoText().process(story, data, targetNameOrig); + BasicOutput.getOutput(OutputType.TEXT, isWriteInfo()).process(story, + data, targetNameOrig); InfoCover.writeInfo(data, targetNameOrig, story.getMeta()); IOUtils.writeSmallFile(data, "version", "3.0"); diff --git a/src/be/nikiroo/fanfix/output/Html.java b/src/be/nikiroo/fanfix/output/Html.java index 581c949..f5fbb83 100644 --- a/src/be/nikiroo/fanfix/output/Html.java +++ b/src/be/nikiroo/fanfix/output/Html.java @@ -37,7 +37,8 @@ class Html extends BasicOutput { // write a copy of the originals inside InfoCover.writeInfo(dir, targetName, story.getMeta()); InfoCover.writeCover(dir, targetName, story.getMeta()); - new InfoText().process(story, dir, targetNameOrig); + BasicOutput.getOutput(OutputType.TEXT, isWriteInfo()).process(story, + dir, targetNameOrig); target = new File(targetDir, targetName + getDefaultExtension(true));