X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Foutput%2FEpub.java;h=fc2dc8c982127210c308d6a9dc70a20b667162eb;hb=878ec53820a09ab01397bfe74b3e0f3884e6f9cd;hp=e3280d124fcfde473df65bb415805eaefbfab468;hpb=13fdb89adc017452a7a72f552b933f8e7b869413;p=fanfix.git
diff --git a/src/be/nikiroo/fanfix/output/Epub.java b/src/be/nikiroo/fanfix/output/Epub.java
index e3280d1..fc2dc8c 100644
--- a/src/be/nikiroo/fanfix/output/Epub.java
+++ b/src/be/nikiroo/fanfix/output/Epub.java
@@ -36,7 +36,7 @@ class Epub extends BasicOutput {
String targetNameOrig = targetName;
targetName += getDefaultExtension(false);
- tmpDir = Instance.getTempFiles().createTempDir("fanfic-reader-epub");
+ tmpDir = Instance.getInstance().getTempFiles().createTempDir("fanfic-reader-epub");
tmpDir.delete();
if (!tmpDir.mkdir()) {
@@ -136,8 +136,11 @@ class Epub extends BasicOutput {
// OPS/images
if (story.getMeta() != null && story.getMeta().getCover() != null) {
File file = new File(images, "cover");
- Instance.getCache().saveAsImage(story.getMeta().getCover(), file,
- true);
+ try {
+ Instance.getInstance().getCache().saveAsImage(story.getMeta().getCover(), file, true);
+ } catch (Exception e) {
+ Instance.getInstance().getTraceHandler().error(e);
+ }
}
// OPS/* except chapters
@@ -242,8 +245,7 @@ class Epub extends BasicOutput {
break;
case IMAGE:
File file = new File(images, getCurrentImageBestName(false));
- Instance.getCache().saveAsImage(para.getContentImage(), file,
- nextParaIsCover);
+ Instance.getInstance().getCache().saveAsImage(para.getContentImage(), file, nextParaIsCover);
writer.write("
");
break;
@@ -354,11 +356,10 @@ class Epub extends BasicOutput {
private void generateNcx(Chapter chap, StringBuilder builder, int navPoint) {
String name;
if (chap.getName() != null && !chap.getName().isEmpty()) {
- name = Instance.getTrans().getString(StringId.CHAPTER_NAMED,
- chap.getNumber(), chap.getName());
+ name = Instance.getInstance().getTrans().getString(StringId.CHAPTER_NAMED, chap.getNumber(),
+ chap.getName());
} else {
- name = Instance.getTrans().getString(StringId.CHAPTER_UNNAMED,
- chap.getNumber());
+ name = Instance.getInstance().getTrans().getString(StringId.CHAPTER_UNNAMED, chap.getNumber());
}
String nnn = String.format("%03d", (navPoint - 2));
@@ -436,8 +437,9 @@ class Epub extends BasicOutput {
builder.append("\n ");
if (story.getMeta() != null && story.getMeta().getCover() != null) {
- String format = Instance.getConfig()
- .getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER).toLowerCase();
+ String format = Instance.getInstance().getConfig()
+ .getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER)
+ .toLowerCase();
builder.append("\n - ");
}
@@ -482,7 +484,7 @@ class Epub extends BasicOutput {
author = meta.getAuthor();
}
- String format = Instance.getConfig()
+ String format = Instance.getInstance().getConfig()
.getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER).toLowerCase();
builder.append("");