Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for epub parser #795

Merged
merged 14 commits into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,39 +63,9 @@ public void onActivityResult(Activity activity, int requestCode, int resultCode,
if (epubPath != null && epubPath.toLowerCase().endsWith(".epub")) {
PyObject savePath = epubParser.callAttr("parseEpub", epubPath, "/data/data/com.rajarsheechatterjee.LNReader/files/");
promise.resolve(savePath.toString());
} else {
promise.reject("Invalid file format");
}
} else {
promise.reject("Directory selection canceled");
}
}
/*
private final ActivityEventListener activityEventListener = new BaseActivityEventListener() {
//@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data){
if(requestCode == REQUEST_DIRECTORY && resultCode == Activity.RESULT_OK){
Uri uri = data.getData();
String folderPath = getFilePathFromUri(uri);
//Log.d("file name", folderPath);
epubPath = folderPath;
//Log.d("epub path", epubPath);
Python py = Python.getInstance();
PyObject epubParser = py.getModule("epubParser");
if(epubPath != null && epubPath.toLowerCase().endsWith(".epub")){
//Log.d("file name", epubPath);
PyObject getContent = epubParser.callAttr("parseEpub",epubPath,"/data/data/com.rajarsheechatterjee.LNReader/files/"); //dunno if that's the right app ID
epubPath = null;
promise.resolve(null);
} else{
promise.reject("Bad file");
}
}
else{
promise.reject("Directory selection canceled");
}
}
};*/

@Override
public String getName(){
Expand Down