Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-20-2023, 04:38 PM   #1
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Pocket Book Sync Koreader book progress with library

Hi all,

I created a small script to sync the current book progress in KoReader with the PocketBook default library.

Link: https://github.com/jjrrw174/PocketBo...ith-PB-Library

I would like to try and make this run in the background of KoReader. Something like on page refresh, or a configurable timer. If anyone has info on how this could work please reply

Info

Small .sh script to update PocketBook library with current KoReader book progress

TESTED ON POCKETBOOK ERA, LATEST FIRMWARE
Requires SH_IVTOOLS

A shell script that will take your most recently opend KoReader book and insert or update a record to the PocketBook library. SH_IVTOOL is used to print a summary of the Book title, id, current page, and total number of pages and wether a update or insert happened.

How it works:
  1. Open the KoReader statistics.sqlite3 database and find the most recently updated book
  2. Get the total pages ,current page and, book title from the KoReader statistics.sqlite3 database with greatest last open time
  3. Find the book title in the explorer-3.db database
  4. Get the ID from the matching book title from the explorer3.db database
  5. Find if a record exists in the books_settings table with the bookid in the explorer-3.db database
  6. If no record, insert a record for this
  7. If record is found, update the current record

To install:
  1. Copy the updateCurrentPage.app to the /applications/ folder of your PocketBook
  2. Download the SH_IVTOOLS from http://komary.net/sh_ivtool/
  3. Copy the SH_IVTOOLS to /mnt/ext1/system/bin folder and rename to SH_IVTOOL.app

To use:
  1. Start device
  2. Go to applications
  3. Scroll to find @currentPageUpdate
  4. Press @currentPageUpdate

To-do:
Add ability to sync all book progress
Add ability to detect current page = total pages and mark as complete
Add this to KoReader as an automated process(On page refresh, every x minutes, on standy, etc.)
jrw174 is offline   Reply With Quote
Old 05-20-2023, 04:49 PM   #2
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Found a bug that is not taking the true current page. Looking at fixing.
jrw174 is offline   Reply With Quote
Advert
Old 05-20-2023, 05:37 PM   #3
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Quote:
Originally Posted by jrw174 View Post
Found a bug that is not taking the true current page. Looking at fixing.
Fixed. Read about the statistics plugin to get a better understanding. Now syncs last read page. Example: You are on page 30, it will sync 29 since it was the last page read.

Noticed that going back in the book doesn't update the statistics plugin in the same place. Adding this as a to-do
jrw174 is offline   Reply With Quote
Old 05-21-2023, 06:19 AM   #4
neil_swann80
0000000000101010
neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.
 
neil_swann80's Avatar
 
Posts: 5,711
Karma: 11482159
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
Nice work.

Do you think it would be feasible to sync in both directions? I.e. which ever reader has the furthest progress is synced to the other?
neil_swann80 is online now   Reply With Quote
Old 05-21-2023, 06:31 AM   #5
neil_swann80
0000000000101010
neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.
 
neil_swann80's Avatar
 
Posts: 5,711
Karma: 11482159
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
FYI... you can use the built-in "dialog" executable rather than SH_IVTOOL so your script won't need the additional file.
SH_IVTOOL is still very useful for text input though.

For example:

Code:
dialog 1 "" "Inserted record for Book Title: $currentBookTitle, Book ID: $pbBookID, Current Page: $currentPageNum, Of Total Pages $totalPageCount" "OK"
neil_swann80 is online now   Reply With Quote
Advert
Old 05-21-2023, 09:18 AM   #6
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Quote:
Originally Posted by neil_swann80 View Post
Nice work.

Do you think it would be feasible to sync in both directions? I.e. which ever reader has the furthest progress is synced to the other?
Good question... My quick morning brain fog say no only because of the way epubs work. Let's say on PBReader you have a large font(30 or something) and on KoReader you have 21. You would be much further ahead in KoReader after syncing from PBReader.

Interesting to think about and try though. It may work as the sync sets the total number of pages. Not sure if the reflow would break that or not.

Quote:
FYI... you can use the built-in "dialog" executable rather than SH_IVTOOL so your script won't need the additional file.
SH_IVTOOL is still very useful for text input though.
I didn't know that! Thanks for the tip. I'll change that asap
jrw174 is offline   Reply With Quote
Old 05-22-2023, 11:22 AM   #7
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Created new version V 0.3

Chages:
Removed SH_IVTOOL dependencies
Removed unused code
Removed echos
Added error handling
Added error output messages
Added exits and quits to ensure script fully closes
jrw174 is offline   Reply With Quote
Old 05-23-2023, 01:55 AM   #8
nhedgehog
Guru
nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.
 
Posts: 771
Karma: 625816
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
Very cool! I was missing this without even realizing that I missed it. Thanks!
nhedgehog is offline   Reply With Quote
Old 05-23-2023, 02:49 AM   #9
nhedgehog
Guru
nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.nhedgehog ought to be getting tired of karma fortunes by now.
 
Posts: 771
Karma: 625816
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
Tested (v. 0.4) it with 3 devices with different firmware with the same error:
"Error detected at Getting pocketbook book ID"

Devices:
PB 631 FW U631_5.20.1527
PB 740 FW U740.6.7.1701
PB 1040 U1040.6.7.1911

v. 0.2 from the 05.21 seems to be working (on all 3 devices) though the pages sync is not as exactly as I hoped, need to do more tests.

Last edited by nhedgehog; 05-23-2023 at 03:10 AM.
nhedgehog is offline   Reply With Quote
Old 05-23-2023, 08:30 AM   #10
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Quote:
Originally Posted by nhedgehog View Post
Tested (v. 0.4) it with 3 devices with different firmware with the same error:
"Error detected at Getting pocketbook book ID"

Devices:
PB 631 FW U631_5.20.1527
PB 740 FW U740.6.7.1701
PB 1040 U1040.6.7.1911

v. 0.2 from the 05.21 seems to be working (on all 3 devices) though the pages sync is not as exactly as I hoped, need to do more tests.
I'll take a look at it. Thanks for letting me know! Strange that 0.2 works I'll post back by the end of the day
jrw174 is offline   Reply With Quote
Old 05-27-2023, 08:12 PM   #11
nuovodna
Enthusiast
nuovodna began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Jan 2023
Device: Kindle Paperwhite
Thanks a lot for this tool, very useful!

Is it possible to sync highlights too?
nuovodna is offline   Reply With Quote
Old 05-28-2023, 02:22 PM   #12
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
V 0.5 release

**EDIT**
Seems like the user who runs the software can't create or write to files. Looking for a way around this that doesn't require a root and chmod.
***END***
V 0.5 released today. Includes better error handling.

Added Sql Errors
Added generic errors
Added currentPageUpdateLog.txt to the /applications directory. You will get a better idea of what's happening during the script. Re-writes the file each time the app is run.

Quote:
Originally Posted by nuovodna View Post
Thanks a lot for this tool, very useful!

Is it possible to sync highlights too?
Not on the list of things yet but something I could look at after trying to get it working in KoReader instead of manual app.

Last edited by jrw174; 05-28-2023 at 06:16 PM.
jrw174 is offline   Reply With Quote
Old 05-28-2023, 06:18 PM   #13
EastEriq
Groupie
EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.
 
Posts: 183
Karma: 194590
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
On PB 631 as well. 0.5 sort of works: only if ssh in the (rooted) device and run the script from shell. In that case I get the dialog "Updated record for Book Title: ... ID: nnnn, Current Page: n, Of Total Pages nnn". And the librarian shows the updated percentage.

If I run the app from the application menu, I only get a dialog with "Error detected at Get KoReader book Id.Error is"

trying the ealiser versions: v04 from app, for a change the dialog shows "Error detected at Getting pocketbook book ID". v03 cannot run, probably because of the missing "#!/bin/sh".

Let me know if some logs would help.
EastEriq is offline   Reply With Quote
Old 05-28-2023, 06:50 PM   #14
jrw174
Connoisseur
jrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the roughjrw174 is a jewel in the rough
 
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
Quote:
Originally Posted by EastEriq View Post
On PB 631 as well. 0.5 sort of works: only if ssh in the (rooted) device and run the script from shell. In that case I get the dialog "Updated record for Book Title: ... ID: nnnn, Current Page: n, Of Total Pages nnn". And the librarian shows the updated percentage.

If I run the app from the application menu, I only get a dialog with "Error detected at Get KoReader book Id.Error is"

trying the ealiser versions: v04 from app, for a change the dialog shows "Error detected at Getting pocketbook book ID". v03 cannot run, probably because of the missing "#!/bin/sh".

Let me know if some logs would help.
I think I got it now with V 0.5.1

I assumed (incorrectly) that the script was running in the directory I wanted. I added CD /to/correct/dir and now it should work. It was failing on creating the log file since it was in the root dir and not the applications dir.

Thanks for giving it a try
jrw174 is offline   Reply With Quote
Old 05-29-2023, 02:29 AM   #15
EastEriq
Groupie
EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.EastEriq can program the VCR without an owner's manual.
 
Posts: 183
Karma: 194590
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
yes thanks, with cd /mnt/ext1/applications now it works as .app as well. I have still to understand though under what refresh conditions the librarian shows the updated percentage - if just after changing view a number of times or after a device reboot. I'll keep experimenting a bit.
On a side note: I would have written the log file in /tmp/, so not to clutter the application directory.
Compliments for the work, in any event!
EastEriq is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sync KOReader progress with Boox Library Geremia Onyx Boox 1 11-14-2022 07:55 AM
Progress sync between koreader and ios Joretapo Kobo Reader 5 10-26-2020 08:21 PM
Looking for an offline method to sync book highlights/notes on KOReader kokaros Kindle Developer's Corner 6 03-25-2020 01:35 PM
How can I change KOReader password for Progress Sync? frittatahubris KOReader 6 02-09-2020 08:39 AM
Aura H2O KSM Wifi keeps turning off / Koreader progress sync tayseidel Kobo Developer's Corner 1 12-24-2015 09:27 PM


All times are GMT -4. The time now is 05:56 AM.


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