Fixes, new version number: 0.9.2 fanfix-0.9.2
authorNiki Roo <niki@nikiroo.be>
Sun, 12 Feb 2017 23:32:55 +0000 (00:32 +0100)
committerNiki Roo <niki@nikiroo.be>
Sun, 12 Feb 2017 23:32:55 +0000 (00:32 +0100)
Some problems related to the Bundles and .properties files were fixed

README.md
VERSION
libs/nikiroo-utils-0.9.5-sources.jar [moved from libs/nikiroo-utils-0.9.4-sources.jar with 83% similarity]
src/be/nikiroo/fanfix/Instance.java
src/be/nikiroo/fanfix/Library.java
src/be/nikiroo/fanfix/data/MetaData.java

index 37865b7a1a2961f36b4f1efadb4fe5fa6f51a170..92f592938ba8f287211cc78a4d2b20ee2be4f603 100644 (file)
--- 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
 
 
 ## 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
 
 
 ## Usage
 
@@ -71,10 +71,10 @@ You can also import the java sources into, say, [Eclipse](https://eclipse.org/),
 
 ### Dependant libraries (included)
 
 
 ### 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.
 
 
 Note that calling ```make libs``` will export the libraries into the src/ directory.
 
diff --git a/VERSION b/VERSION
index f374f6662e9a1983e9b8a534a3295df618772ffe..2003b639c40025a4216b7b765e800b872a9052cd 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.9.1
+0.9.2
similarity index 83%
rename from libs/nikiroo-utils-0.9.4-sources.jar
rename to libs/nikiroo-utils-0.9.5-sources.jar
index 49bee8e49348622c1ebfd66a51bc8126784f5fe7..7e424791ebb8637014546b728cc47b6f1b97eee7 100644 (file)
Binary files a/libs/nikiroo-utils-0.9.4-sources.jar and b/libs/nikiroo-utils-0.9.5-sources.jar differ
index 9c20682fd8d6798da64eea8406ddfc86fa1c9dee..91902c3ba7b02494c0ee340b433be123263464ca 100644 (file)
@@ -47,7 +47,9 @@ public class Instance {
                        }
                        try {
                                trans = new StringIdBundle(getLang());
                        }
                        try {
                                trans = new StringIdBundle(getLang());
+                               System.out.println("UPDATING");
                                trans.updateFile(configDir);
                                trans.updateFile(configDir);
+                               System.out.println("UPDATED");
                        } catch (IOException e) {
                                syserr(e);
                        }
                        } catch (IOException e) {
                                syserr(e);
                        }
index 304f19f462e1a05a899e4b01de430e6c283abfef..abe760b0d24e31862764093be7bdbcf0b670ce0d 100644 (file)
@@ -75,6 +75,26 @@ public class Library {
                return list;
        }
 
                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<MetaData, File> entry : getStories().entrySet()) {
+                               if (luid.equals(entry.getKey().getLuid())) {
+                                       return entry.getKey();
+                               }
+                       }
+               }
+
+               return null;
+       }
+
        /**
         * Retrieve a {@link File} corresponding to the given {@link Story}.
         * 
        /**
         * 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 {
         *             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
 
                if (luid == null || luid.isEmpty()) {
                        getStories(); // refresh lastId if needed
index 5ec980163f5ed014018febc6a3fcd020870ddeff..55c18de7d0596d0ba43b925ae00c0773100806a8 100644 (file)
@@ -1,6 +1,7 @@
 package be.nikiroo.fanfix.data;
 
 import java.awt.image.BufferedImage;
 package be.nikiroo.fanfix.data;
 
 import java.awt.image.BufferedImage;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
 import java.util.List;
 
 /**
@@ -8,7 +9,7 @@ import java.util.List;
  * 
  * @author niki
  */
  * 
  * @author niki
  */
-public class MetaData {
+public class MetaData implements Cloneable {
        private String title;
        private String author;
        private String date;
        private String title;
        private String author;
        private String date;
@@ -313,4 +314,28 @@ public class MetaData {
        public void setImageDocument(boolean imageDocument) {
                this.imageDocument = imageDocument;
        }
        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<String>();
+                       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;
+       }
 }
 }