use of com.foobnix.ext.FooterNote in project LibreraReader by foobnix.
the class HtmlContext method openDocumentInner.
@Override
public CodecDocument openDocumentInner(String fileName, String password) {
Map<String, String> notes = null;
try {
FooterNote extract = HtmlExtractor.extract(fileName, CacheZipUtils.CACHE_BOOK_DIR.getPath());
fileName = extract.path;
notes = extract.notes;
LOG.d("new file name", fileName);
} catch (Exception e) {
LOG.e(e);
}
MuPdfDocument muPdfDocument = new MuPdfDocument(this, MuPdfDocument.FORMAT_PDF, fileName, password);
muPdfDocument.setFootNotes(notes);
return muPdfDocument;
}
use of com.foobnix.ext.FooterNote in project LibreraReader by foobnix.
the class MobiContext method openDocumentInner.
@Override
public CodecDocument openDocumentInner(String fileName, String password) {
LOG.d("Context", "MobiContext", fileName);
if (cacheFile.isFile()) {
fileNameEpub = cacheFile.getPath();
LOG.d("Context", "MobiContext cache", fileNameEpub);
} else {
try {
int outName = BookCSS.get().isAutoHypens ? "temp".hashCode() : originalHashCode;
FooterNote extract = MobiExtract.extract(fileName, CacheZipUtils.CACHE_BOOK_DIR.getPath(), outName + "");
fileNameEpub = extract.path;
if (BookCSS.get().isAutoHypens) {
EpubExtractor.proccessHypens(fileNameEpub, cacheFile.getPath());
fileNameEpub = cacheFile.getPath();
}
LOG.d("Context", "MobiContext extract", fileNameEpub);
} catch (Exception e) {
LOG.e(e);
}
}
final MuPdfDocument muPdfDocument = new MuPdfDocument(this, MuPdfDocument.FORMAT_PDF, fileNameEpub, password);
final File jsonFile = new File(cacheFile + ".json");
if (jsonFile.isFile()) {
muPdfDocument.setFootNotes(JsonHelper.fileToMap(jsonFile));
LOG.d("Load notes from file", jsonFile);
} else {
new Thread() {
@Override
public void run() {
Map<String, String> notes = null;
try {
notes = EpubExtractor.get().getFooterNotes(fileNameEpub);
LOG.d("new file name", fileNameEpub);
muPdfDocument.setFootNotes(notes);
JsonHelper.mapToFile(jsonFile, notes);
LOG.d("save notes to file", jsonFile);
removeTempFiles();
} catch (Exception e) {
LOG.e(e);
}
}
}.start();
}
return muPdfDocument;
}
use of com.foobnix.ext.FooterNote in project LibreraReader by foobnix.
the class TxtContext method openDocumentInner.
@Override
public CodecDocument openDocumentInner(String fileName, String password) {
Map<String, String> notes = null;
try {
FooterNote extract = TxtExtract.extract(fileName, CacheZipUtils.CACHE_BOOK_DIR.getPath());
fileName = extract.path;
notes = extract.notes;
LOG.d("new file name", fileName);
} catch (Exception e) {
LOG.e(e);
}
MuPdfDocument muPdfDocument = new MuPdfDocument(this, MuPdfDocument.FORMAT_PDF, fileName, password);
muPdfDocument.setFootNotes(notes);
return muPdfDocument;
}
Aggregations