OK, I couldn't resist and digged deeper. (Is this already spamming?)
I found a way to trigger the logic that saves page stats. But the function implementing this only performs a database insert if the duration is > 0. I don't know how exactly the duration is measured, in the end it doesn't matter: Because of this we basically know that we can't rely on the page_stat_data always being up to date.
That's the bad news.
The good news is that it's actually super easy to get the current page number inside KOReader with each page turn. This is faster (because no database operations on page_data_stats are required) and more reliable.
The only thing I had to do is to change the script to get the page namber as an command line argument instead of fetching it from the database.
Because the script isn't meant to be executed as a stand-alone I moved it to a different location and changed the extension.
I've pushed the latest changed. Feel free to test & give me some feedback. For me it works quite well now.
|