From 5083ef84efb7e001c0b5de235d3424e1b59c62f4 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 2 Dec 2017 15:03:51 +0100 Subject: [PATCH] Fix cover file not sent over wire --- .../nikiroo/fanfix/library/BasicLibrary.java | 8 ++++++-- src/be/nikiroo/fanfix/output/BasicOutput.java | 19 +++++++++++++++++++ src/be/nikiroo/fanfix/output/Cbz.java | 3 ++- src/be/nikiroo/fanfix/output/Epub.java | 3 ++- src/be/nikiroo/fanfix/output/Html.java | 3 ++- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 66fb9435..4c32e3c2 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 036a1564..30c2ac66 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 c70cc412..8853c769 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 2c47dcbc..1ff6888a 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 581c9495..f5fbb831 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)); -- 2.27.0