From: Niki Roo Date: Sun, 12 Feb 2017 23:32:55 +0000 (+0100) Subject: Fixes, new version number: 0.9.2 X-Git-Tag: fanfix-0.9.2 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=301791d3fc0f152942b542e3d98ebddc0af528f2;p=fanfix.git Fixes, new version number: 0.9.2 Some problems related to the Bundles and .properties files were fixed --- diff --git a/README.md b/README.md index 37865b7..92f5929 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ We support a few file types for local story conversion (both as input and as out ## Supported platforms -Any platform with at lest Java 1.5 on it should be ok. +Any platform with at lest Java 1.6 on it should be ok. -If you have any problems to compile it with a supported Java version (1.4 won't work, but you may try to cross-compile; 1.8 had been tested and works), please contact me. +If you have any problems to compile it with a supported Java version (1.5 won't work, but you may try to cross-compile or change the Bundle.java class from the utilities; 1.6 and 1.8 have been tested and work), please contact me. ## Usage @@ -71,10 +71,10 @@ You can also import the java sources into, say, [Eclipse](https://eclipse.org/), ### Dependant libraries (included) -- libs/nikiroo-utils-sources-0.9.2.jar: some shared utility functions I also use elsewhere -- [libs/unbescape-1.1.4-sources.jar](https://github.com/unbescape/unbescape): a nice library to escape/unescape a lot of text formats; I only use it for HTML +- libs/nikiroo-utils-sources.jar: some shared utility functions I also use elsewhere +- [libs/unbescape-sources.jar](https://github.com/unbescape/unbescape): a nice library to escape/unescape a lot of text formats; I only use it for HTML -Nothing else but Java 1.5+. +Nothing else but Java 1.6+. Note that calling ```make libs``` will export the libraries into the src/ directory. diff --git a/VERSION b/VERSION index f374f66..2003b63 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.1 +0.9.2 diff --git a/libs/nikiroo-utils-0.9.4-sources.jar b/libs/nikiroo-utils-0.9.5-sources.jar similarity index 83% rename from libs/nikiroo-utils-0.9.4-sources.jar rename to libs/nikiroo-utils-0.9.5-sources.jar index 49bee8e..7e42479 100644 Binary files a/libs/nikiroo-utils-0.9.4-sources.jar and b/libs/nikiroo-utils-0.9.5-sources.jar differ diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 9c20682..91902c3 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -47,7 +47,9 @@ 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 304f19f..abe760b 100644 --- a/src/be/nikiroo/fanfix/Library.java +++ b/src/be/nikiroo/fanfix/Library.java @@ -75,6 +75,26 @@ public class Library { return list; } + /** + * Retrieve a {@link File} corresponding to the given {@link Story}. + * + * @param luid + * the Library UID of the story + * + * @return the corresponding {@link Story} + */ + public MetaData getInfo(String luid) { + if (luid != null) { + for (Entry entry : getStories().entrySet()) { + if (luid.equals(entry.getKey().getLuid())) { + return entry.getKey(); + } + } + } + + return null; + } + /** * Retrieve a {@link File} corresponding to the given {@link Story}. * @@ -207,7 +227,7 @@ public class Library { * in case of I/O error */ private Story save(Story story, String luid) throws IOException { - MetaData key = story.getMeta(); + MetaData key = story.getMeta().clone(); if (luid == null || luid.isEmpty()) { getStories(); // refresh lastId if needed diff --git a/src/be/nikiroo/fanfix/data/MetaData.java b/src/be/nikiroo/fanfix/data/MetaData.java index 5ec9801..55c18de 100644 --- a/src/be/nikiroo/fanfix/data/MetaData.java +++ b/src/be/nikiroo/fanfix/data/MetaData.java @@ -1,6 +1,7 @@ package be.nikiroo.fanfix.data; import java.awt.image.BufferedImage; +import java.util.ArrayList; import java.util.List; /** @@ -8,7 +9,7 @@ import java.util.List; * * @author niki */ -public class MetaData { +public class MetaData implements Cloneable { private String title; private String author; private String date; @@ -313,4 +314,28 @@ public class MetaData { public void setImageDocument(boolean imageDocument) { this.imageDocument = imageDocument; } + + @Override + public MetaData clone() { + MetaData meta = null; + try { + meta = (MetaData) super.clone(); + } catch (CloneNotSupportedException e) { + // Did the clones rebel? + System.err.println(e); + } + + if (tags != null) { + meta.tags = new ArrayList(); + meta.tags.addAll(tags); + } + if (resume != null) { + meta.resume = new Chapter(resume.getNumber(), resume.getName()); + for (Paragraph para : resume) { + meta.resume.getParagraphs().add(para); + } + } + + return meta; + } }