git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'ee020e75a5de0c1e54557db79f77edc50e05ea04'
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
supported
/
Epub.java
diff --git
a/src/be/nikiroo/fanfix/supported/Epub.java
b/src/be/nikiroo/fanfix/supported/Epub.java
index 356e3a88fcbdb9d43905a5c6717ed10c62309cb1..f8e467831381185244eae24b15d3a96a6cb0f6cb 100644
(file)
--- a/
src/be/nikiroo/fanfix/supported/Epub.java
+++ b/
src/be/nikiroo/fanfix/supported/Epub.java
@@
-1,7
+1,6
@@
package be.nikiroo.fanfix.supported;
import java.io.File;
package be.nikiroo.fanfix.supported;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
@@
-17,8
+16,8
@@
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.utils.IOUtils;
import be.nikiroo.utils.Image;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.utils.IOUtils;
import be.nikiroo.utils.Image;
-import be.nikiroo.utils.MarkableFileInputStream;
import be.nikiroo.utils.StringUtils;
import be.nikiroo.utils.StringUtils;
+import be.nikiroo.utils.streams.MarkableFileInputStream;
/**
* Support class for EPUB files created with this program (as we need some
/**
* Support class for EPUB files created with this program (as we need some
@@
-34,11
+33,6
@@
class Epub extends InfoText {
private URL fakeSource;
private InputStream fakeIn;
private URL fakeSource;
private InputStream fakeIn;
- @Override
- public String getSourceName() {
- return "epub";
- }
-
public File getSourceFileOriginal() {
return super.getSourceFile();
}
public File getSourceFileOriginal() {
return super.getSourceFile();
}
@@
-48,10
+42,8
@@
class Epub extends InfoText {
try {
return new File(fakeSource.toURI());
} catch (URISyntaxException e) {
try {
return new File(fakeSource.toURI());
} catch (URISyntaxException e) {
- Instance.getTraceHandler()
- .error(new IOException(
- "Cannot get the source file from the info-text URL",
- e));
+ Instance.getInstance().getTraceHandler()
+ .error(new IOException("Cannot get the source file from the info-text URL", e));
}
return null;
}
return null;
@@
-63,9
+55,7
@@
class Epub extends InfoText {
try {
fakeIn.reset();
} catch (IOException e) {
try {
fakeIn.reset();
} catch (IOException e) {
- Instance.getTraceHandler()
- .error(new IOException(
- "Cannot reset the Epub Text stream", e));
+ Instance.getInstance().getTraceHandler().error(new IOException("Cannot reset the Epub Text stream", e));
}
return fakeIn;
}
return fakeIn;
@@
-93,8
+83,7
@@
class Epub extends InfoText {
ZipInputStream zipIn = null;
try {
zipIn = new ZipInputStream(in);
ZipInputStream zipIn = null;
try {
zipIn = new ZipInputStream(in);
- tmpDir = Instance.getTempFiles().createTempDir(
- "fanfic-reader-parser");
+ tmpDir = Instance.getInstance().getTempFiles().createTempDir("fanfic-reader-parser");
File tmp = new File(tmpDir, "file.txt");
File tmpInfo = new File(tmpDir, "file.info");
File tmp = new File(tmpDir, "file.txt");
File tmpInfo = new File(tmpDir, "file.info");
@@
-117,7
+106,7
@@
class Epub extends InfoText {
String entryLName = entry.getName().toLowerCase();
boolean imageEntry = false;
String entryLName = entry.getName().toLowerCase();
boolean imageEntry = false;
- for (String ext :
BasicSupport
Images.getImageExt(false)) {
+ for (String ext :
bs
Images.getImageExt(false)) {
if (entryLName.endsWith(ext)) {
imageEntry = true;
}
if (entryLName.endsWith(ext)) {
imageEntry = true;
}
@@
-135,7
+124,7
@@
class Epub extends InfoText {
try {
cover = new Image(zipIn);
} catch (Exception e) {
try {
cover = new Image(zipIn);
} catch (Exception e) {
- Instance.getTraceHandler().error(e);
+ Instance.get
Instance().get
TraceHandler().error(e);
}
}
} else if (entry.getName().equals(getDataPrefix() + "URL")) {
}
}
} else if (entry.getName().equals(getDataPrefix() + "URL")) {
@@
-179,8
+168,7
@@
class Epub extends InfoText {
}
if (tmp.exists()) {
}
if (tmp.exists()) {
- this.fakeIn = new MarkableFileInputStream(new FileInputStream(
- tmp));
+ this.fakeIn = new MarkableFileInputStream(tmp);
}
if (tmpInfo.exists()) {
}
if (tmpInfo.exists()) {
@@
-198,7
+186,7
@@
class Epub extends InfoText {
meta = new MetaData();
meta.setLang("en");
meta.setTags(new ArrayList<String>());
meta = new MetaData();
meta.setLang("en");
meta.setTags(new ArrayList<String>());
- meta.setSource(getSourceName());
+ meta.setSource(get
Type().get
SourceName());
meta.setUuid(url);
meta.setUrl(url);
meta.setTitle(title);
meta.setUuid(url);
meta.setUrl(url);
meta.setTitle(title);
@@
-210,7
+198,6
@@
class Epub extends InfoText {
if (cover != null) {
meta.setCover(cover);
} else {
if (cover != null) {
meta.setCover(cover);
} else {
-System.out.println(">>> " + getSourceFileOriginal());
meta.setCover(InfoReader
.getCoverByName(getSourceFileOriginal().toURI()
.toURL()));
meta.setCover(InfoReader
.getCoverByName(getSourceFileOriginal().toURI()
.toURL()));