View Single Post
Old 01-29-2020, 10:50 PM   #18
mergen3107
Wizard
mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.mergen3107 ought to be getting tired of karma fortunes by now.
 
mergen3107's Avatar
 
Posts: 1,510
Karma: 5000046
Join Date: Feb 2012
Location: Cape Canaveral
Device: Kindle Scribe
Here is some progress on the progressbar project :D
(follow ups are provided in bold - from 02/12/2020)

1) I created a GitHub repo. Current version archive is attached here as well.

2) Current version (1.87), unfortunately, is very raw.
It is supposed to be a KUAL extension, but for now I run the Drawgressbar.sh script from ssh, while Kindle has an open book.

3) How it works:
- the user manually inputs necessary book max length in locations, location steps during page turns, chapter and subchapter locations (obtained from ToC)
- the script calculates necessary dimensions, then draws the progressbar by eips.

It can only fetch the current location from /var/local/cc.db, because cc.db is updated only on book closing. It should, in future, be able to redraw the progressbar at every page turn by using a new location estimate. I think I should try to fetch a more precise new location that appears in 'showlog -f' at every page turn, but they seem to be in the units of html symbols or something instead of locations.

However here comes my main issue:
4) awk page turn detection code is not working (lines 231-232 in my script, commented out for now). I took this part from Showtime extension. Maybe this is related to bash binary, which I discussed above? I use it to be able to work with arrays in bash.
(the main issue was that I didn't export variables in bash part of the script. Once I did, all the variables are available as ENVRION["variable"] in awk itself, and system("echo $variable") in the system access through awk. )

Also, I don't know how to feed a multiline argument for that awk action.
Each desired line break column should be "\", and NO other new white spaces should be added. e.g.
Code:
awk '/.*pattern1*./ {system("echo \
$variable")} '


5) I don't know how to catch 'page turn forward' and 'page turn backward' actions separately.
Code:
&> /var/log/messages && 2>/dev/null tail -F /var/log/messages | exec parselog | \
awk '/.*PageTurn=Next*./ {action1} /.*PageTurn=Previous*./ {action2} '


6) The script has patches of python and different workarounds (bash is terrible in working with decimals!) here and there, so I will probably switch to python completely later. At least for the calculation part, because I don't know how to access eips from python.

7) Can you please explain me about the need in any open source licenses? I know it is just an extension for KUAL, but since this is my first large public project, I would like to properly acknowledge all parts of work I used and make sure everyone can benefit from this project. I wrote a made-up terms in the beginning of the script for now.

Guys can you please help me to finish this project until at least a properly working extension? :)

Thank you!
Attached Thumbnails
Click image for larger version

Name:	screenshot_2020_01_28T16_23_16-0500.png
Views:	193
Size:	88.2 KB
ID:	176750  
Attached Files
File Type: zip DrawgressBar_v1.87.zip (484.7 KB, 164 views)

Last edited by mergen3107; 02-12-2020 at 03:36 PM.
mergen3107 is offline   Reply With Quote