View Single Post
Old 01-29-2019, 05:16 AM   #11
PromethiumL
Member
PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'PromethiumL knows the difference between 'who' and 'whom'
 
Posts: 22
Karma: 10000
Join Date: Mar 2018
Location: HK
Device: KOA2
Another approch?

Quote:
Originally Posted by mergen3107 View Post
Some updates on my investigation.

1) I used showlog -f to see what is going on with the opened book. I was able to get something like this:
Code:
...
190113:223323 cvm[15492]: I ReaderInfoLog:BookInformation:book asin=f3203e96-c039-416b-aa47-9082f48637e3,file size=2200211,file last mod date=2018-11-18 18.56.26 -0500,content type=ebook,language=en/en,length=MobiPosition_ 1530687,access=2019-01-13 22.28.24 -0500,last read position=MobiSerializedPosition_ 968606 968607,isEncrypted=false,isSample=false,isNew=false,isTTSMetdataPresent=false,isTTSMetadataAllowed=true,fileExtn=mobi:
...
These length=MobiPosition_ 1530687 and last read position=MobiSerializedPosition_ 968606 968607 are definitely within my interest, however only the former appears in the cc.db . These values from showlog and cc.db match: 'length' and 'p_contentSize'; calculated 'last read position'/'length' and 'p_percentFinished' (about 63%).

2) @NiLuJe,
Thank you very much!
I tried your part of code from 'cover'extract' about extracting sqlite entries into variable and it works. So now I can tweak my needs of fetching these pieces of data from the last opened book. Particularly I only need p_contentSize, p_percentFinished types of data.

One problem I found though is that cc.db seems to be updated upon each book close, not every page turn. So now I have to think about how to properly determine current position to redraw it.

3) I used KindleUnpack plugin in Calibre to see mobi7 and mobi8 (azw3) files' contents.
For mobi7 toc.ncx file easily shows file position of each TOC entry:
Code:
...
<navMap>
    <navPoint id="np_1" playOrder="1">
    <navLabel>
    <text>Title Page</text>
    </navLabel>
    <content src="book.html#filepos241"/>
    </navPoint>
    <navPoint id="np_2" playOrder="2">
    <navLabel>
    <text>Copyright</text>
    </navLabel>
    <content src="book.html#filepos816"/>
    </navPoint>
    <navPoint id="np_3" playOrder="3">
...
As for mobi8, however, it is a little more tricky! toc.ncx does not reveal entries' position, but only tocref### references. Surprisingly for me, mobi8 files resemble epub files a lot, which also rely only on xhtml content size.
However, %book/Text/ folder contains separate files, each of which represents just another TOC entry (but it doesn't differentiate of which level).

So I am thinking about two things:
1) I should give up on different TOC level indications on progress bar;
2) I can calculate very rough position of these TOC entries based on ... cumulative file sizes with respect to total file size of this folder I tried it manually by hand on Victor Hugo's 'Les Miserables' (about 2500 print pages) and it works within +/- 3%

I'll try to write a little PC script (when I find enough free time) to pre-process mobi7 and mobi8 files to extract TOC entries' positions.
It occured to me that in KOReader there is the OCR-looking-up-dictionary feature, so, when there have already been the xx% hint at the bottom while reading, you may as well capture the screen, and cut out the numbers from the picture file, then use tesseract to get the progress?

However, one of the drawbacks is you must enable the reading progress display, so there's no way to get locations/progress from the screen directly.

Let me have a try.

Last edited by PromethiumL; 01-29-2019 at 05:22 AM.
PromethiumL is offline   Reply With Quote