Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
check new document settings path for updating progress
Browse files Browse the repository at this point in the history
  • Loading branch information
chrox committed Jul 17, 2016
1 parent d87f232 commit 76897fa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2016-07-17 13:53 chrox

* check new document settings path for updating progress and possibly add
support for Kindle Oasis

2016-04-23 21:06 chrox

* add support for firmware version 5.7.4
Expand Down
2 changes: 1 addition & 1 deletion build-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

HACKNAME="kpvbooklet"
PKGNAME="${HACKNAME}"
PKGVER="0.6.3"
PKGVER="0.6.4"

# We need kindletool (https://github.com/NiLuJe/KindleTool) in $PATH
if (( $(kindletool version | wc -l) == 1 )) ; then
Expand Down
22 changes: 16 additions & 6 deletions src/com/github/chrox/kpvbooklet/KPVBooklet.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,23 @@ public void run() {
*/
private float extractPercentFinished(String history_dir, String path) {
float percent_finished = 0.0f;
int slash = path.lastIndexOf('/');
String parentname = (slash == -1) ? "" : path.substring(0, slash+1);
String basename = (slash == -1) ? "" : path.substring(slash+1);
String histroypath = history_dir + "[" + parentname.replace('/','#') + "] " + basename + ".lua";
log("I: found history file: " + histroypath);
int lastSlash = path.lastIndexOf('/');
String parentname = (lastSlash == -1) ? "" : path.substring(0, lastSlash+1);
String filename = (lastSlash == -1) ? "" : path.substring(lastSlash+1);
int lastDot = filename.lastIndexOf('.');
String basename = (lastDot == -1) ? "" : filename.substring(0, lastDot);
String extname = (lastDot == -1) ? "" : filename.substring(lastDot+1);
String histroyPath = history_dir + "[" + parentname.replace('/','#') + "] " + filename + ".lua";
String metadataPath = parentname + basename + ".sdr/metadata." + extname + ".lua";
File settingsFile = new File(metadataPath);
if (!settingsFile.exists()) {
settingsFile = new File(histroyPath);
}

log("I: found document settings file: " + settingsFile.getPath());
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(histroypath)));
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(settingsFile.getPath())));
String line;
while ((line = br.readLine()) != null) {
if (line.indexOf("[\"percent_finished\"]") > -1) {
Expand Down

0 comments on commit 76897fa

Please # to comment.