## 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
### 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.
}
try {
trans = new StringIdBundle(getLang());
+ System.out.println("UPDATING");
trans.updateFile(configDir);
+ System.out.println("UPDATED");
} catch (IOException e) {
syserr(e);
}
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}.
*
* 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
package be.nikiroo.fanfix.data;
import java.awt.image.BufferedImage;
+import java.util.ArrayList;
import java.util.List;
/**
*
* @author niki
*/
-public class MetaData {
+public class MetaData implements Cloneable {
private String title;
private String author;
private String date;
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;
+ }
}