View Single Post
Old 12-09-2012, 12:05 AM   #802
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 728
Karma: 2314258
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by chrox View Post
See the project KPVBooklet at https://github.com/chrox/KPVBooklet.
KPVBooklet works also on Kindle Touch 5.1.2 with the following patch (applied to commit aca92dabff):
Spoiler:
PHP Code:
diff --git a/src/com/github/chrox/kpvbooklet/KPVBooklet.java b/src/com/github/chrox/kpvbooklet/KPVBooklet.java
index 27c456a
..6a9b7a2 100644
--- a/src/com/github/chrox/kpvbooklet/KPVBooklet.java
+++ b/src/com/github/chrox/kpvbooklet/KPVBooklet.java
@@ -8,+8,@@ import java.util.Date;
 
import org.json.simple.JSONObject;
 
import org.json.simple.JSONArray;
 
-
import com.amazon.ebook.util.log.d;
+
import com.amazon.ebook.util.log.Log;
+
import com.amazon.ebook.util.log.LogSystem;
 
import com.amazon.kindle.booklet.AbstractBooklet;
 
import com.amazon.kindle.restricted.runtime.Framework;
 
import com.amazon.kindle.restricted.content.catalog.ContentCatalog;
@@ -
22,23 +23,23 @@ import com.amazon.kindle.restricted.content.catalog.ContentCatalog;
  */
 public class 
KPVBooklet extends AbstractBooklet {
 
-    private final 
d logger d.CBb("KPVBooklet");
+    private final 
Log logger LogSystem.getLog("KPVBooklet");
     private final 
String kpdfviewer "/mnt/us/kindlepdfviewer/kpdf.sh";
     
     private 
Process kpdfviewerProcess;
     
     public 
KPVBooklet() {
-        
logger.hmA("KPVBooklet");
+        
logger.info("KPVBooklet");
     }
     
     public 
void start(URI contentURI) {
         
String path contentURI.getPath();
-        
logger.hmA("Opening " path " with kindlepdfviewer...");
+        
logger.info("Opening " path " with kindlepdfviewer...");
         
String[] cmd = new String[] {kpdfviewerpath};
         try {
             
kpdfviewerProcess Runtime.getRuntime().exec(cmd);
         } catch (
IOException e) {
-            
logger.xIb(e.toString(), e);
+            
logger.error(e.toString(), e);
         }
         
         
Thread thread = new kpdfviewerWaitThread(path);
@@ -
46,13 +47,13 @@ public class KPVBooklet extends AbstractBooklet {
     }
 
     public 
void stop() {
-        
logger.hmA("stop()");
+        
logger.info("stop()");
         
// Stop kpdfviewer
         
if (kpdfviewerProcess != null) {
             try {
                 
killQuitProcess(kpdfviewerProcess);
             } catch (
Exception e) {
-                
logger.xIb(e.toString(), e);
+                
logger.error(e.toString(), e);
             }
         }
         
super.stop();
@@ -
91,+92,@@ public class KPVBooklet extends AbstractBooklet {
                 
// wait for kpdfviewer to finish
                 
kpdfviewerProcess.waitFor();
             } catch (
InterruptedException e) {
-                
logger.xIb(e.toString(), e);
+                
logger.error(e.toString(), e);
             }
             
// update content catlog after kpdfviewer finished
             
updateCC(content_path0.0f);
@@ -
99,+100,@@ public class KPVBooklet extends AbstractBooklet {
             try {
                 
Runtime.getRuntime().exec("lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.home");
             } catch (
IOException e) {
-                
logger.xIb(e.toString(), e);
+                
logger.error(e.toString(), e);
             }
         }
     }
@@ -
120,+121,@@ public class KPVBooklet extends AbstractBooklet {
         
String uuid = (String) value.get("uuid");
         
String json_change "{\"commands\":[{\"update\":{\"uuid\":\"" uuid "\",\"lastAccess\":" lastAccess ",\"percentFinished\":" percentFinished ",\"displayTags\":[\"" tag "\"]" "}}],\"type\":\"ChangeRequest\",\"id\":1}";
         
CCRequest("change"json_change);
-        
logger.hmA("UpdateCC:file:" path ",lastAccess:" lastAccess ",percentFinished:" percentFinished);
+        
logger.info("UpdateCC:file:" path ",lastAccess:" lastAccess ",percentFinished:" percentFinished);
     }
     
     
/**
@@ -131,7 +132,7 @@ public class KPVBooklet extends AbstractBooklet {
      */
     
private JSONObject CCRequest(String req_typeString req_json) {
         
ContentCatalog CC = (ContentCatalog)Framework.getService(ContentCatalog.class);
-        
JSONObject json CC.eL(req_typereq_json2005);
+        
JSONObject json CC.D(req_typereq_json2005);
         return 
json;
     }
 } 

UPD I didn't find any traces of com.lab126.generic.extractor (or, at least, it isn't registered by default), so for displaying of file on Home screen, instead of writing into appreg.db :
Code:
INSERT INTO "associations" VALUES('com.lab126.generic.extractor','extractor','GL:*.djvu','true');
I've added entry in scanner configuration:
Code:
[root@kindle tmp]# mntroot rw
system: I mntroot:def:Making root filesystem writeable
[root@kindle tmp]# cp -r /etc/kdb/system/daemon/scanner/extractors/7 /etc/kdb/system/daemon/scanner/extractors/20
[root@kindle tmp]# sed -ie 's/txt/djvu/g' /etc/kdb/system/daemon/scanner/extractors/20/glob 
[root@kindle tmp]# mntroot ro
system: I mntroot:def:Making root filesystem read-only
[root@kindle tmp]# restart scanner
Directory 7 contains extractor for text files and 20 is a random big number out of range of system extractors number.

Last edited by eureka; 12-09-2012 at 01:11 AM.
eureka is offline   Reply With Quote