Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-14-2016, 08:34 AM   #1
shoelesshunter
copyleft librarian
shoelesshunter began at the beginning.
 
shoelesshunter's Avatar
 
Posts: 58
Karma: 10
Join Date: Nov 2015
Device: KV
kual extension to open a book

how would I go about inserting a menu item into KUAL that would simply open a particular title?

my aim is to place a Calibre generated catalog where I can easily access it.

I am using a Voyage on 5.6.5

thanks.
shoelesshunter is offline   Reply With Quote
Old 08-14-2016, 08:55 AM   #2
nasser
Evangelist
nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.
 
nasser's Avatar
 
Posts: 475
Karma: 445678
Join Date: Feb 2010
Device: Too many..
Well, well.. I too was thinking along the same lines..!
I'm sure it can be done with one of those "lipc" commands. I don't know enough about those.
What would be more interesting is to make the command use KOReader for pdfs, djvus and other formats which the inbuilt reader can't handle well.

Also, I think Aeris's Kindle menu could also do the job and show the book covers too!
nasser is offline   Reply With Quote
Advert
Old 08-14-2016, 09:14 AM   #3
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
That wheel is already invented.
See: KPVbooklet and of course, its source code.
knc1 is offline   Reply With Quote
Old 08-15-2016, 01:43 AM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
To start a Kindlet:
Code:
lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.kindlet/mnt/us/path/to/kindlet.azw2
So I assume you do the same thing only with the lab126 reader framework for standard book types (but I am much too lazy to look it up right now before bed, sorry).

Not sure why anyone wants that though. KindleMenu uses it to launch Kindlets that are otherwise hidden from cluttering your library list. And KPVBooklet already handles alternative filetypes to be listed in the library list and opened through KOReader.


How much utility is gained from opening a catalog book straight through a KUAL extension, anyway? It is not like books are hard to find (but if they are, you might have bigger problems -- namely, organization).
eschwartz is offline   Reply With Quote
Old 08-15-2016, 02:41 AM   #5
shoelesshunter
copyleft librarian
shoelesshunter began at the beginning.
 
shoelesshunter's Avatar
 
Posts: 58
Karma: 10
Join Date: Nov 2015
Device: KV
No, not hard to find, but I thought it would be neat to have a "catalog button" handy, and I couldn't think of where else to put that than in a KUAL extension. Sounds corny, but I'm taking baby steps here.
shoelesshunter is offline   Reply With Quote
Advert
Old 08-15-2016, 03:33 AM   #6
nasser
Evangelist
nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.
 
nasser's Avatar
 
Posts: 475
Karma: 445678
Join Date: Feb 2010
Device: Too many..
Eshwartz, Request you to give the lipc commands to open a book with:
1. The built-in reader
2. KOReader

Yes, You're right about organisation problems with large number of books. I tried using the nested collections feature of Collections manager. But you can't back out from a nested collection. You have to go back home every time. You could also use the search feature. Here, too there are some issues: the indexer sometimes doesn't show a book; You also have to remember some part of the book title!

So, using lipc commands with KUAL may be a solution. I assume KUAL allows nesting of commands to a reasonably deep level. This way you could create categories like fiction, history, science, etc.

Another option would be to have a html page with links that open each book. I believe this could be done with a browser or waf(don't know enough about this).
nasser is offline   Reply With Quote
Old 08-15-2016, 12:32 PM   #7
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
I don't use KOReader, sorry.

As for the builtin reader, I have tested it and sure enough you can use "reader" instead of "kindlet" and it will open a document in the builtin reader.

Works:
Code:
lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.reader/mnt/us/documents/Warbreaker_B002KYHZHA.azw3

But what I have not been able to figure out is, how to inform lipc about a filepath containing spaces. I have tried standard shell escaping, and using quotes. Both return the standard "the application could not be started" message.
eschwartz is offline   Reply With Quote
Old 08-15-2016, 12:55 PM   #8
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by shoelesshunter View Post
No, not hard to find, but I thought it would be neat to have a "catalog button" handy, and I couldn't think of where else to put that than in a KUAL extension. Sounds corny, but I'm taking baby steps here.
Use the 'replace store button' thing for inspiration.

@eschwartz:
NiLuJe recently had to deal with spaces in titles for the screensaver app.
Whatever he did should be among the recent changes in his public repo.

Last edited by knc1; 08-15-2016 at 12:57 PM.
knc1 is offline   Reply With Quote
Old 08-15-2016, 02:24 PM   #9
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
I don't see anything useful.

Although trying to find things via the repo browser is not always fun, less so when it is SVN you are talking about, and I can't figure out how to clone it, and basically, SVN.
So maybe I just missed it. Because trac is kind of awkward anyway.

It's not a big deal -- if it is really important to open a specific ebook using lipc, just make sure that ebook has no complexity-inducing spaces in the filename.
eschwartz is offline   Reply With Quote
Old 08-15-2016, 04:25 PM   #10
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Ah, but wait - this is a UTF-8 based device.

Maybe those blanks in the path and file names are not an ASCII space but a something (UTF-8) that just looks the same.

The kernel's FAT-32 driver may be making some sort of conversion along the way.
knc1 is offline   Reply With Quote
Old 08-15-2016, 06:11 PM   #11
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Well, the spaces I was using were definitely ASCII spaces, since I created the files in question to begin with.

I'd be more motivated to try to find out if there is a solution, if it were a practical problem to begin with. As it is, for the unusual event where you wish to launch an ebook via a static KUAL entry, you can just use a decent filename (spaces are eeeeevil!!)
eschwartz is offline   Reply With Quote
Old 08-15-2016, 06:26 PM   #12
coplate
Guru
coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.coplate ought to be getting tired of karma fortunes by now.
 
Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
Quote:
Originally Posted by eschwartz View Post
Well, the spaces I was using were definitely ASCII spaces, since I created the files in question to begin with.

I'd be more motivated to try to find out if there is a solution, if it were a practical problem to begin with. As it is, for the unusual event where you wish to launch an ebook via a static KUAL entry, you can just use a decent filename (spaces are eeeeevil!!)
You can tell from the data '<schema>://<path>', that the argument is a 'URI'

So you need to URI encode the filename.
For example, replacing spaces with "%20" worked for me on this file:
Quote:
lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.reader/mnt/us/documents/Hunted_%20The%20Iron%20Druid%20Chronicles,%20Book% 20Six_B00AUSCOIS.kfx
I didn't bother checking all the 'reserverd' characters to see if this app could read them but the list is here if you want to make files with them, and then check. But the reserved characters are differnt for each part of the URI - our filename is the 'path' part, and thats defines as:
path-absolute = "/" [ segment-nz *( "/" segment ) ]
and ... and
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

unreserved is whats listed on wikipedia

sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="

https://en.wikipedia.org/wiki/Percent-encoding
https://tools.ietf.org/html/rfc3986

After that, a simple script can do - In the regex, just put all the character that should be allowed - for example, we know that the backslashes are fine, and commas worked for me.:

Quote:
#!/bin/sh

echo "$@" | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | while read l;
do
case "$l" in
[\/-_.~a-zA-Z0-9\:\@\!\$\&\'\(\)\*\+\,\;\=] ) echo -n ${l} ;;
"" ) echo -n %20 ;;
* ) printf '%%%02X' "'$l"
esac
done
echo ""

[root@kindle us]# bash urlencode.sh /mnt/us/documents/Hunted_\ The\ Iron\ Druid\ Chronicles,\ Book\ Six_B00AUSCOIS.kfx
/mnt/us/documents/Hunted_%20The%20Iron%20Druid%20Chronicles,%20Book% 20Six_B00AUSCOIS.kfx


But if a file has that '/' character in it, this wont work, it will treat it as a new directory segment.

Last edited by coplate; 08-15-2016 at 06:54 PM.
coplate is offline   Reply With Quote
Old 08-15-2016, 09:28 PM   #13
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
I vaguely suspected urlencoding might work. But I wasn't about to test it unless I had a motivation to do so manually typing things (without bash filename completion) gets increasingly awkward without copy-paste and on a small touchscreen.

So, good of you to find out for us.
For however useful it is to ensure pre-existing, stable filenames embedded in a script can be embedded with spaces in them.

...

Also, it is probably both more efficient and more portable to do it all in awk: https://gist.github.com/moyashi/4063894
eschwartz is offline   Reply With Quote
Old 08-16-2016, 12:26 PM   #14
nasser
Evangelist
nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.nasser ought to be getting tired of karma fortunes by now.
 
nasser's Avatar
 
Posts: 475
Karma: 445678
Join Date: Feb 2010
Device: Too many..
Quote:
Originally Posted by eschwartz View Post
I don't use KOReader, sorry.

As for the builtin reader, I have tested it and sure enough you can use "reader" instead of "kindlet" and it will open a document in the builtin reader.

Works:
Code:
lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.reader/mnt/us/documents/Warbreaker_B002KYHZHA.azw3
...
I tried this command to open the Kindle user guide (azw3) as also a pdf.
Both opened fine.
I gave the command both from a ssh session from my PC as well as from kterm. Both times, it worked.
...
...
BUT...
It seems to have screwed up kterm in some way. Either kterm doesn't start OR it starts but the on screen keyboard is unresponsive. Needs a restart to set things right.


Any way around this?

{KT3W, G000KA, 5.8.0}

Last edited by nasser; 08-16-2016 at 12:28 PM. Reason: Added my kindle specs
nasser is offline   Reply With Quote
Old 08-16-2016, 12:30 PM   #15
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Huh, that is quite bizarre, and true.

I haven't the foggiest clue why though. Actually, what I noticed is that it only shows that when I don't open kterm using the KUAL menuentry. Which explains why I didn't initially notice.

Even after opening with KUAL... if I try opening kterm using Aeris' KindleMenu or via a custom search bar command, the keyboard is wonky.
eschwartz is offline   Reply With Quote
Reply

Tags
calibre, jailbreak, kual

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU Governor Menu (KUAL extension) knc1 Kindle Developer's Corner 41 09-16-2021 02:54 PM
Is there a Kual Extension/add-on for cloud eduardomb Kindle Developer's Corner 19 07-08-2016 05:43 PM
is there any KUAL extension development guide? fangzi Kindle Developer's Corner 2 01-02-2014 10:11 AM


All times are GMT -4. The time now is 06:43 AM.


MobileRead.com is a privately owned, operated and funded community.