From: Niki Roo Date: Mon, 13 Feb 2017 05:53:55 +0000 (+0100) Subject: Small fixes X-Git-Tag: fanfix-swing-0.0.1~12^2~540 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=a7d266e6616349169d03e93780fb656754089dd0;p=fanfix-swing.git Small fixes "©Author" replaced by "By Author" in text format UPDATING/UPDATED debug messages removed Fix cause of "null: .... imported." (LUID not found) when importing to library: the MetaData object was not updated back into the story --- diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 91902c3b..9c20682f 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -47,9 +47,7 @@ public class Instance { } try { trans = new StringIdBundle(getLang()); - System.out.println("UPDATING"); trans.updateFile(configDir); - System.out.println("UPDATED"); } catch (IOException e) { syserr(e); } diff --git a/src/be/nikiroo/fanfix/Library.java b/src/be/nikiroo/fanfix/Library.java index abe760b0..68f93c53 100644 --- a/src/be/nikiroo/fanfix/Library.java +++ b/src/be/nikiroo/fanfix/Library.java @@ -227,7 +227,9 @@ public class Library { * in case of I/O error */ private Story save(Story story, String luid) throws IOException { + // Do not change the original metadata, but change the original story MetaData key = story.getMeta().clone(); + story.setMeta(key); if (luid == null || luid.isEmpty()) { getStories(); // refresh lastId if needed diff --git a/src/be/nikiroo/fanfix/bundles/resources.properties b/src/be/nikiroo/fanfix/bundles/resources.properties index c835624a..035594f6 100644 --- a/src/be/nikiroo/fanfix/bundles/resources.properties +++ b/src/be/nikiroo/fanfix/bundles/resources.properties @@ -133,5 +133,4 @@ OUTPUT_DESC_SYSOUT = A simple DEBUG console output LATEX_LANG_UNKNOWN = Unknown language: %s # (WHAT: 'by' prefix before author name) # used to output the author, make sure it is covered by Config.BYS for input detection -BY = © -BY_NOUTF = (c) +BY = By diff --git a/src/be/nikiroo/fanfix/output/Text.java b/src/be/nikiroo/fanfix/output/Text.java index 6db7b7be..4555ce62 100644 --- a/src/be/nikiroo/fanfix/output/Text.java +++ b/src/be/nikiroo/fanfix/output/Text.java @@ -59,7 +59,8 @@ class Text extends BasicOutput { writer.write(title); writer.write("\n"); if (author != null && !author.isEmpty()) { - writer.write("©" + author); + writer.write(Instance.getTrans().getString(StringId.BY) + " " + + author); } if (date != null && !date.isEmpty()) { writer.write(" ("); diff --git a/src/be/nikiroo/fanfix/supported/InfoText.java b/src/be/nikiroo/fanfix/supported/InfoText.java index 4f1dc39d..8d4d97d9 100644 --- a/src/be/nikiroo/fanfix/supported/InfoText.java +++ b/src/be/nikiroo/fanfix/supported/InfoText.java @@ -30,10 +30,11 @@ class InfoText extends Text { MetaData meta = InfoReader.readMeta(new File(new File(source .toURI()).getPath() + ".info")); - // Some old .info files don't have this information... + // Some old .info files don't have those now required fields... String test = meta.getTitle() == null ? "" : meta.getTitle(); test += meta.getAuthor() == null ? "" : meta.getAuthor(); test += meta.getDate() == null ? "" : meta.getDate(); + test += meta.getUrl() == null ? "" : meta.getUrl(); if (test.isEmpty()) { MetaData superMeta = super.getMeta(source, reset(in)); if (meta.getTitle() == null || meta.getTitle().isEmpty()) { @@ -45,6 +46,9 @@ class InfoText extends Text { if (meta.getDate() == null || meta.getDate().isEmpty()) { meta.setDate(superMeta.getDate()); } + if (meta.getUrl() == null || meta.getUrl().isEmpty()) { + meta.setUrl(superMeta.getUrl()); + } } return meta;