* @author niki
*/
class Epub extends InfoText {
- private File sourceFileOriginal;
-
private MetaData meta;
private File tmpDir;
private String desc;
private URL fakeSource;
private InputStream fakeIn;
- @Override
- public String getSourceName() {
- return "epub";
- }
-
public File getSourceFileOriginal() {
- return sourceFileOriginal;
+ return super.getSourceFile();
}
@Override
@Override
protected InputStream getInput() {
- return fakeIn;
+ if (fakeIn != null) {
+ try {
+ fakeIn.reset();
+ } catch (IOException e) {
+ Instance.getTraceHandler()
+ .error(new IOException(
+ "Cannot reset the Epub Text stream", e));
+ }
+
+ return fakeIn;
+ }
+
+ return null;
}
@Override
if (tmpInfo.exists()) {
meta = InfoReader.readMeta(tmpInfo, true);
- if (cover != null) {
- meta.setCover(cover);
- }
tmpInfo.delete();
} else {
if (title == null || title.isEmpty()) {
meta = new MetaData();
meta.setLang("en");
meta.setTags(new ArrayList<String>());
- meta.setSource(getSourceName());
+ meta.setSource(getType().getSourceName());
meta.setUuid(url);
meta.setUrl(url);
meta.setTitle(title);
meta.setAuthor(author);
meta.setImageDocument(isImagesDocumentByDefault());
}
+
+ if (meta.getCover() == null) {
+ if (cover != null) {
+ meta.setCover(cover);
+ } else {
+ meta.setCover(InfoReader
+ .getCoverByName(getSourceFileOriginal().toURI()
+ .toURL()));
+ }
+ }
} finally {
if (zipIn != null) {
zipIn.close();