Fix tests:
authorNiki Roo <niki@nikiroo.be>
Sun, 25 Mar 2018 09:46:45 +0000 (11:46 +0200)
committerNiki Roo <niki@nikiroo.be>
Sun, 25 Mar 2018 09:46:45 +0000 (11:46 +0200)
- language upper/lower case
- "TYPE=" in info files not always correct

13 files changed:
src/be/nikiroo/fanfix/output/BasicOutput.java
src/be/nikiroo/fanfix/output/Cbz.java
src/be/nikiroo/fanfix/output/Epub.java
src/be/nikiroo/fanfix/output/Html.java
src/be/nikiroo/fanfix/supported/E621.java
src/be/nikiroo/fanfix/supported/EHentai.java
src/be/nikiroo/fanfix/supported/Epub.java
src/be/nikiroo/fanfix/supported/Fanfiction.java
src/be/nikiroo/fanfix/supported/Fimfiction.java
src/be/nikiroo/fanfix/supported/FimfictionApi.java
src/be/nikiroo/fanfix/supported/MangaFox.java
src/be/nikiroo/fanfix/supported/Text.java
src/be/nikiroo/fanfix/supported/YiffStar.java

index a1aedca663c8586eb48a8d79f1afb67efb907ae5..dc6fe51de2cb1d6e66c4bbe06af2e1850bf99847 100644 (file)
@@ -336,10 +336,10 @@ public abstract class BasicOutput {
                        story.getMeta().setType("" + getType());
                }
 
-               if (writeCover) {
+               if (isWriteCover()) {
                        InfoCover.writeCover(targetDir, targetName, story.getMeta());
                }
-               if (writeInfo) {
+               if (isWriteInfo()) {
                        InfoCover.writeInfo(targetDir, targetName, story.getMeta());
                }
 
index a84428c4f155d35273649ed8c550918b9606f12d..4a89d9b92a54551845ab57dc653f79dd17229d01 100644 (file)
@@ -33,6 +33,11 @@ class Cbz extends BasicOutput {
                                        .setType(OutputType.TEXT, isWriteInfo(), false)
                                        .process(story, dir, targetNameOrig);
 
+                       try {
+                               super.process(story, targetDir, targetNameOrig);
+                       } finally {
+                       }
+
                        InfoCover.writeInfo(dir, targetNameOrig, story.getMeta());
                        if (story.getMeta() != null && !story.getMeta().isFakeCover()) {
                                InfoCover.writeCover(dir, targetNameOrig, story.getMeta());
@@ -40,11 +45,6 @@ class Cbz extends BasicOutput {
 
                        IOUtils.writeSmallFile(dir, "version", "3.0");
 
-                       try {
-                               super.process(story, targetDir, targetNameOrig);
-                       } finally {
-                       }
-
                        IOUtils.zip(dir, target, true);
                } finally {
                        IOUtils.deltree(dir);
index 21297581d937e3883fdae501f3467f045e5d7ecd..64797d395f1442d0d49220f4072bb7df832e9634 100644 (file)
@@ -44,6 +44,8 @@ class Epub extends BasicOutput {
                                        "Cannot create a temporary directory: no space left on device?");
                }
 
+               super.process(story, targetDir, targetNameOrig);
+
                // "Originals"
                File data = new File(tmpDir, "DATA");
                data.mkdir();
@@ -52,8 +54,6 @@ class Epub extends BasicOutput {
                InfoCover.writeInfo(data, targetNameOrig, story.getMeta());
                IOUtils.writeSmallFile(data, "version", "3.0");
 
-               super.process(story, targetDir, targetNameOrig);
-
                // zip/epub
                File epub = new File(targetDir, targetName);
                IOUtils.zip(tmpDir, epub, true);
index e91c6f46bfe896b65024bb9f10d3d37abfc2732f..756eb8d328907e3d02eb19cede3c57dd51082ce4 100644 (file)
@@ -32,12 +32,6 @@ class Html extends BasicOutput {
                target.mkdir();
                dir = target;
 
-               // write a copy of the originals inside
-               InfoCover.writeInfo(dir, targetName, story.getMeta());
-               InfoCover.writeCover(dir, targetName, story.getMeta());
-               BasicOutput.getOutput(OutputType.TEXT, isWriteInfo(), isWriteCover())
-                               .process(story, dir, targetNameOrig);
-
                target = new File(targetDir, targetName + getDefaultExtension(true));
 
                writer = new BufferedWriter(new OutputStreamWriter(
@@ -49,6 +43,12 @@ class Html extends BasicOutput {
                        writer = null;
                }
 
+               // write a copy of the originals inside
+               InfoCover.writeInfo(dir, targetName, story.getMeta());
+               InfoCover.writeCover(dir, targetName, story.getMeta());
+               BasicOutput.getOutput(OutputType.TEXT, isWriteInfo(), isWriteCover())
+                               .process(story, dir, targetNameOrig);
+
                if (story.getMeta().getCover() != null) {
                        Instance.getCache().saveAsImage(story.getMeta().getCover(),
                                        new File(dir, "cover"), true);
index 5fe99a8fe0db698f02586af65b7e90643a8fa345..298ccf16bee07f2b2d3a3124a34543c095dfe2f3 100644 (file)
@@ -45,7 +45,7 @@ class E621 extends BasicSupport_Deprecated {
                meta.setPublisher(getSourceName());
                meta.setUuid(source.toString());
                meta.setLuid("");
-               meta.setLang("EN");
+               meta.setLang("en");
                meta.setSubject("Furry");
                meta.setType(getType().toString());
                meta.setImageDocument(true);
index 574ea0656c82168f73a9d9f5980d7870eb9a4b0b..2fe70d9714a7cbe396a42f2a572a020f1b18c219 100644 (file)
@@ -108,11 +108,11 @@ class EHentai extends BasicSupport_Deprecated {
                if (langLine != null) {
                        langLine = StringUtils.unhtml(langLine).trim();
                        if (langLine.equalsIgnoreCase("English")) {
-                               lang = "EN";
+                               lang = "en";
                        } else if (langLine.equalsIgnoreCase("Japanese")) {
-                               lang = "JP";
+                               lang = "jp";
                        } else if (langLine.equalsIgnoreCase("French")) {
-                               lang = "FR";
+                               lang = "fr";
                        } else {
                                // TODO find the code?
                                lang = langLine;
index 8ae4c6c37052c5569674804b3be5d4fa3244f343..ce9bd06f7a7b15efc358fac017b1313cc03763ed 100644 (file)
@@ -189,7 +189,7 @@ class Epub extends InfoText {
                        }
 
                        meta = new MetaData();
-                       meta.setLang("EN");
+                       meta.setLang("en");
                        meta.setTags(new ArrayList<String>());
                        meta.setSource(getSourceName());
                        meta.setUuid(url);
index 0feb9641be2f2ea85f896c9b21da2511c6d3a8b5..4193fa01e92eca1acc4f572ea3efb20eb4386ae8 100644 (file)
@@ -49,7 +49,7 @@ class Fanfiction extends BasicSupport_Deprecated {
                meta.setPublisher(getSourceName());
                meta.setUuid(source.toString());
                meta.setLuid("");
-               meta.setLang("EN");
+               meta.setLang("en"); //TODO!
                meta.setSubject(getSubject(reset(in)));
                meta.setType(getType().toString());
                meta.setImageDocument(false);
index ed9c9adf867439cd3154d3f6d00f0e5d30479403..1f72031b9e745c89df00625543cfe66208a196bc 100644 (file)
@@ -47,7 +47,7 @@ class Fimfiction extends BasicSupport_Deprecated {
                meta.setPublisher(getSourceName());
                meta.setUuid(source.toString());
                meta.setLuid("");
-               meta.setLang("EN");
+               meta.setLang("en");
                meta.setSubject("MLP");
                meta.setType(getType().toString());
                meta.setImageDocument(false);
index 231405b96f9678e7c233fb097ff6b7a51012d424..6ef8a2cc70d8bb65e7c32b4b94fce81d96f07bea 100644 (file)
@@ -128,7 +128,7 @@ class FimfictionApi extends BasicSupport_Deprecated {
                meta.setPublisher(getSourceName());
                meta.setUuid(source.toString());
                meta.setLuid("");
-               meta.setLang("EN");
+               meta.setLang("en");
                meta.setSubject("MLP");
                meta.setType(getType().toString());
                meta.setImageDocument(false);
index 5abc47b090ce563e1801bcd0ebed7c10cc09d47f..b6d3fe133ce1a70ace47f92ac4bab21805172ac6 100644 (file)
@@ -66,7 +66,7 @@ class MangaFox extends BasicSupport {
                meta.setPublisher(getSourceName());
                meta.setUuid(getSource().toString());
                meta.setLuid("");
-               meta.setLang("EN");
+               meta.setLang("en");
                meta.setSubject("manga");
                meta.setType(getType().toString());
                meta.setImageDocument(true);
index fb4a0ad2a7d97c73dcbe37a025df58a0e8f931c4..a6105947faab29f348f158edb32d008bc2301b5b 100644 (file)
@@ -95,9 +95,9 @@ class Text extends BasicSupport_Deprecated {
                }
 
                if (lang == null) {
-                       lang = "EN";
+                       lang = "en";
                } else {
-                       lang = lang.toUpperCase();
+                       lang = lang.toLowerCase();
                }
 
                return lang;
index ca331e5adac7564d499793dbc793705606507ae2..2996ce993770993d18460bcfe4b10c9ddcb8e470 100644 (file)
@@ -44,7 +44,7 @@ class YiffStar extends BasicSupport_Deprecated {
                meta.setPublisher(getSourceName());
                meta.setUuid(source.toString());
                meta.setLuid("");
-               meta.setLang("EN");
+               meta.setLang("en");
                meta.setSubject("Furry");
                meta.setType(getType().toString());
                meta.setImageDocument(false);