import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import javax.imageio.ImageIO;
-
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.ImageUtils;
import be.nikiroo.utils.MarkableFileInputStream;
+import be.nikiroo.utils.Progress;
/**
* Support class for EPUB files created with this program (as we need some
}
@Override
- protected List<Entry<String, URL>> getChapters(URL source, InputStream in)
- throws IOException {
+ protected List<Entry<String, URL>> getChapters(URL source, InputStream in,
+ Progress pg) throws IOException {
if (fakeIn != null) {
fakeIn.reset();
- return super.getChapters(fakeSource, fakeIn);
+ return super.getChapters(fakeSource, fakeIn, pg);
}
return null;
}
@Override
- protected String getChapterContent(URL source, InputStream in, int number)
- throws IOException {
+ protected String getChapterContent(URL source, InputStream in, int number,
+ Progress pg) throws IOException {
if (fakeIn != null) {
fakeIn.reset();
- return super.getChapterContent(fakeSource, fakeIn, number);
+ return super.getChapterContent(fakeSource, fakeIn, number, pg);
}
return null;
if (!entry.isDirectory()
&& entry.getName().startsWith(getDataPrefix())) {
String entryLName = entry.getName().toLowerCase();
-
+
boolean imageEntry = false;
for (String ext : getImageExt(false)) {
if (entryLName.endsWith(ext)) {
// Cover
if (getCover()) {
try {
- cover = ImageIO.read(zipIn);
+ cover = ImageUtils.fromStream(zipIn);
} catch (Exception e) {
Instance.syserr(e);
}
}
if (tmpInfo.exists()) {
- meta = InfoReader.readMeta(tmpInfo);
+ meta = InfoReader.readMeta(tmpInfo, true);
if (cover != null) {
meta.setCover(cover);
}
meta.setLang("EN");
meta.setTags(new ArrayList<String>());
meta.setSource(getSourceName());
+ meta.setUrl(source.toString());
}
}
tmp = null;
- fakeIn.close();
+ if (fakeIn != null) {
+ fakeIn.close();
+ }
+
super.close();
}