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 03-13-2024, 11:21 AM   #61
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,191
Karma: 10057265
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
I don't think that will work.

A temporary fix for you would mostly likely be:
Code:
    local sql = [[
            REPLACE INTO books_settings
            (bookid, profileid, cpage, npage, completed, opentime)
            VALUES (?, 2, ?, ?, ?, ?)
        ]]
Until someone provides a fix to handle multiple profiles.

At pbterm this clunky line of code returns the current profile name:
Code:
profileName=$(readlink -f /mnt/ext1/system/profiles/.current); echo ${profileName##*/}
This works to get the variable into LUA:
(won't work if profiles never enabled/configured though)
Code:
local h1 = io.popen('test=$(readlink -f /mnt/ext1/system/profiles/.current); echo ${test##*/}')
local h2 = h1:read('*a')
-- removes newline
local profileName = h2:gsub('[\n\r]', '')
h1:close()

Last edited by neil_swann80; 03-14-2024 at 02:10 AM.
neil_swann80 is online now   Reply With Quote
Old 03-13-2024, 03:56 PM   #62
llaumgui
Member
llaumgui began at the beginning.
 
llaumgui's Avatar
 
Posts: 16
Karma: 10
Join Date: Mar 2024
Location: Prades le Lez
Device: Vivlio Light HD (PocketBook Verse pro)
The hardcode fix work fine currently ;-).
llaumgui is offline   Reply With Quote
Advert
Old 03-13-2024, 04:15 PM   #63
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,191
Karma: 10057265
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
This should work across multiple reading profiles:
(and if you've never setup additional profiles)

Code:
local h1 = io.popen('test=$(readlink -f /mnt/ext1/system/profiles/.current); if [ $? != 0 ]; then echo "default"; else echo ${test##*/}; fi')
local h2 = h1:read('*a')
local profile_name = h2:gsub('[\n\r]', '')
h1:close()
local stmt = pocketbookDbConn:prepare("SELECT id FROM profiles WHERE name = ?")
local temp_id = stmt:reset():bind(profile_name):step()
stmt:close()
local profile_id = temp_id[1]
local sql = [[
	REPLACE INTO books_settings
	(bookid, profileid, cpage, npage, completed, opentime)
		VALUES (?, ?, ?, ?, ?, ?)
]]
local stmt = pocketbookDbConn:prepare(sql)
stmt:reset():bind(book_id, profile_id, data.page, data.totalPages, data.completed, data.time):step()
stmt:close()
EDIT: Zip removed. Latest improved version HERE

Last edited by neil_swann80; 03-31-2024 at 12:47 PM.
neil_swann80 is online now   Reply With Quote
Old 03-16-2024, 11:28 AM   #64
llaumgui
Member
llaumgui began at the beginning.
 
llaumgui's Avatar
 
Posts: 16
Karma: 10
Join Date: Mar 2024
Location: Prades le Lez
Device: Vivlio Light HD (PocketBook Verse pro)
Quote:
Originally Posted by neil_swann80 View Post
EDIT: Could someone confirm the attached modified plugin works for them?
Works well on my own device.
Work for me. You can do a PR :-).
llaumgui is offline   Reply With Quote
Old 03-16-2024, 02:48 PM   #65
EastEriq
Groupie
EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!
 
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
WFM (no profile), but with a glitch which was probably already in https://github.com/ckilb/pocketbooksync.koplugin . Some books percentages are not updated, and even stay put at 100% in the librarian. One of the books for which this happens to me is https://www.gutenberg.org/ebooks/72966 for what matters.

I've added a
Code:
logger.info(" syncing to page " .. tostring(data.page) .. " of book " .. tostring(book_id))
at line 103 to check what is going on in crash.log, and found by accident that book_id appear to be the same (1447LL) for one book which updates correctly and one which not.
EastEriq is offline   Reply With Quote
Advert
Old 03-17-2024, 02:34 AM   #66
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,191
Karma: 10057265
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
Quote:
Originally Posted by EastEriq View Post
...and found by accident that book_id appear to be the same (1447LL) for one book which updates correctly and one which not.
I'm not sure what 1447LL refers to, as the book_id in the explorer-3.db file are all purely numerical and should definitely be unique. (Likely being modified by the "tostring" function. Try "tonumber" instead. See below)

I've tested the book you linked to on my device and it is updating correctly.

Maybe a problem with your database? Try editing the book's metadata in Calibre. Choose the "Download metadata" option and select a template and new cover, then upload the new file to your device. It should show as a new book with a new and unique book_id... then test if its progress is updated by the plugin.

FYI: Also try this logger command instead:
Code:
logger.info("Syncing to page " .. tonumber(data.page) .. " of book_id " .. tonumber(book_id) .. " with filename: " .. tostring(data.file) .. "")

Last edited by neil_swann80; 03-17-2024 at 04:33 AM.
neil_swann80 is online now   Reply With Quote
Old 03-17-2024, 02:55 AM   #67
llaumgui
Member
llaumgui began at the beginning.
 
llaumgui's Avatar
 
Posts: 16
Karma: 10
Join Date: Mar 2024
Location: Prades le Lez
Device: Vivlio Light HD (PocketBook Verse pro)
@neil_swann80 > Since I have replaced the extension by your code, I have 2 "Pocketbook sync" listed in extensions list. The second is not activable... I think, it's a cache issue... Is there a way to clear cache of KOReader ?
llaumgui is offline   Reply With Quote
Old 03-17-2024, 04:00 AM   #68
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,191
Karma: 10057265
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
Quote:
Originally Posted by llaumgui View Post
@neil_swann80 > Since I have replaced the extension by your code, I have 2 "Pocketbook sync" listed in extensions list. The second is not activable... I think, it's a cache issue... Is there a way to clear cache of KOReader ?
I am not experiencing this issue.

I think the only way this can happen is if you've somehow duplicated the pocketbooksync.koplugin directory. The directory can be called anything before the .koplugin and as long as the contents are the same it'll appear as a duplicate Pocketbook sync on the plugins management page.

Perhaps try to search the entire plugins directory for files containing the string: pocketbooksync

In pbterm:
Code:
grep "pocketbooksync" /mnt/ext1/applications/koreader/plugins/*/_meta.lua
There should obviously only be one match.

Last edited by neil_swann80; 03-17-2024 at 01:31 PM.
neil_swann80 is online now   Reply With Quote
Old 03-17-2024, 05:03 PM   #69
EastEriq
Groupie
EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!
 
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
Quote:
Originally Posted by neil_swann80 View Post
I'm not sure what 1447LL refers to, as the book_id in the explorer-3.db file are all purely numerical and should definitely be unique.
....
FYI: Also try this logger command instead:
Code:
logger.info("Syncing to page " .. tonumber(data.page) .. " of book_id " .. tonumber(book_id) .. " with filename: " .. tostring(data.file) .. "")
Ok, had a closer look into it, bringing both databases to the computer and inspecting them with sqlitebrowser, and also printing out more information as you suggested. So, my databases look at first glance sane; 1477 is the actual book_settings/bookid = books_impl/id of one of my books whose percentage updates correctly, whereas 1447 is the id of one which doesn't (here I mixed up, sorry).

Of course there numbers are entirely particular of the set of books I have loaded on my reader throughout its history. But the point is: the books which stay put at 100% have book_settings/complete=1 even if they have book_settings/cpage < book_settings/npage in explorer-3.db, even if I have opened them last in koreader and paged them to what is reported as cpage.

complete in turn comes (line 50-52) from self.ui.doc_settings:readSetting("summary"), i.e. from koreader itself.

It looks that once completed, forever completed, systematically for other books as well. I don't know whether to consider this a bug or a feature. In the back of my mind I think I read something about a recent change about flagging the book as completed in koreader.

ETA: ah, oh yes: in koreader, Book Status/Mark as finished... Once set back to Mark as reading I get the expected percentage in the librarian.

Last edited by EastEriq; 03-17-2024 at 05:10 PM.
EastEriq is offline   Reply With Quote
Old 03-18-2024, 12:10 AM   #70
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,191
Karma: 10057265
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
Quote:
Originally Posted by EastEriq View Post
in koreader, Book Status/Mark as finished... Once set back to Mark as reading I get the expected percentage in the librarian.
I'm glad you got that sorted. As it can be controlled easily from koreader then I'd say it's a feature!
neil_swann80 is online now   Reply With Quote
Old 03-18-2024, 03:13 AM   #71
EastEriq
Groupie
EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!
 
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
yep. But - do I get it wrong? If I open back in pbreader the book I've opened in koreader, shouldn't it open very approximately at the same point I left it in koreader, all reservations about different pagination pending? Because for me it doesn't; it always opens on the book's first page in pbreader. Unless I'm mistaken, I think that the very first version of the shell script was behaving right in that respect.
OTOH, with the present koreader plugin form the librarian immediately shows the updated percentage, whereas with the shell version that happened unclearly only after some directory view refresh or total reboot.
EastEriq is offline   Reply With Quote
Old 03-18-2024, 03:18 AM   #72
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,191
Karma: 10057265
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
Quote:
Originally Posted by EastEriq View Post
yep. But - do I get it wrong? If I open back in pbreader the book I've opened in koreader, shouldn't it open very approximately at the same point I left it in koreader, all reservations about different pagination pending? Because for me it doesn't; it always opens on the book's first page in pbreader. Unless I'm mistaken, I think that the very fist version of the shell script was behaving right in that respect.
OTOH, with the present koreader plugin form the librarian immediately shows the updated percentage, whereas with the shell version that happened unclearly only after some directory view refresh or total reboot.
As far as I know this plugin has never synced the reading progress between PBReader and KOReader, only updates the homescreen info with last read by KOReader and progress bar. Without this plugin a new book opened directly through KOReader (not launching from PB Library) wouldn't appear on the homescreen etc.

I have an idea of how to add this functionality (progress sync between readers); I may attempt it at some point.

Last edited by neil_swann80; 03-18-2024 at 03:22 AM.
neil_swann80 is online now   Reply With Quote
Old 03-18-2024, 03:18 AM   #73
EastEriq
Groupie
EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!EastEriq rocks like Gibraltar!
 
Posts: 169
Karma: 100516
Join Date: Jan 2018
Device: Cybook Orizon, PocketBook Touch HD
Quote:
Originally Posted by nhedgehog View Post
Yes exactly! Strange I was so sure that it was working like this before.
So I'm not the only one remembering it tht way...
EastEriq is offline   Reply With Quote
Old 03-18-2024, 03:34 AM   #74
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,191
Karma: 10057265
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
jrw174 makes a good point about whether this is feasible on page-1 HERE
(This may have dashed my idea for a "progress sync" solution too)

For the most recent profile friendly version of the plugin see attached...
Attached Files
File Type: zip pocketbooksync.koplugin.zip (4.8 KB, 24 views)

Last edited by neil_swann80; 03-31-2024 at 03:53 PM.
neil_swann80 is online now   Reply With Quote
Old 04-17-2024, 02:18 PM   #75
xanderx
Member
xanderx began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Apr 2024
Device: Pocketbook inkpad 3 colour
Hi. I have installed the script and the plugin, however when opening books with koreader my homescreen does not update last read book. Am I doing something wrong?
My device is Pocketbook inkpad 3 colour
Thank you!
xanderx 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 06:55 AM
Progress sync between koreader and ios Joretapo Kobo Reader 5 10-26-2020 07:21 PM
Looking for an offline method to sync book highlights/notes on KOReader kokaros Kindle Developer's Corner 6 03-25-2020 12:35 PM
How can I change KOReader password for Progress Sync? frittatahubris KOReader 6 02-09-2020 07:39 AM
Aura H2O KSM Wifi keeps turning off / Koreader progress sync tayseidel Kobo Developer's Corner 1 12-24-2015 08:27 PM


All times are GMT -4. The time now is 02:39 PM.


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