calibre-web icon indicating copy to clipboard operation
calibre-web copied to clipboard

"Sync to last page read?" message each time Kobo ebook is unlocked when synced to calibre-web

Open metroid2010 opened this issue 2 years ago • 11 comments

Describe the bug/problem Using a Kobo Libra 2 synced with calibre-web as per instructions. Everything is working correctly (syncing of ebooks, downloading, status...). I have no other readers nor do I use the integrated reader in calibre-web. I do not access Calibre, and use calibre-web only to manage book uploads and metadata.

Each time the device is unlocked a message reading "Sync to last page read? It looks like you've been reading on another device. Would you like to resume on the page you most recently opened? CANCEL/YES" pops up on the screen, after a few seconds. If I press OK, the reader goes to the very first page. If I press CANCEL, nothing happens and I can continue where I last left. Again, I do not access the ebooks I am reading through any other device.

To Reproduce Steps to reproduce the behavior:

  1. Sync Kobo device with calibre-web as wiki instructs.
  2. Download synced ebook from calibre-web. Start reading.
  3. Lock screen, unlock again. Message pops up.

Logfile ACCESS:

[datetime-lock] "PUT /kobo/<hash>/v1/library/<another-hash>/state HTTP/1.1" 200 879 0.210213
[datetime-unlock] "GET /kobo/<hash>/v1/library/<another-hash>/state HTTP/1.1" 200 1271 0.056056

^ these two api endpoints work. tested on browser, showing correct book info and status (including % read)

CALIBRE-WEB:

[datetime-lock] DEBUG {cps.ub:80} Found stored session: <very-long-hash>
[datetime-unlock] DEBUG {cps.ub:80} Found stored session: <very-long-hash>

No other log messages are found at the times the device is locked and unlocked.

Expected behavior No message poping up on screen each time the device is unlocked if no other device has accessed and progressed the ebook that was being read.

Environment (please complete the following information):

  • OS: NixOS 21.11
  • Python version: 3.8.10
  • Calibre-Web version: 0.6.16
  • Docker container: Linuxserver
  • Special Hardware: none, standard x86_64 pc. Reader: Kobo Libra 2
  • Browser: not relevant to bug

Additional context Sync connection is through local LAN, unencrypted, so no reverse proxy shenanigans.

metroid2010 avatar Feb 03 '22 15:02 metroid2010

I have the exact same issue with the same tech stack.

The message is a minor annoyance, but it would be great to not be asked to sync progress every single time you open the ereader.

manzaloros avatar Feb 22 '22 00:02 manzaloros

Same problem here, but everytime I open the book, it goes back to the beginning of the chapter. It is very annoying. Happens the same way on both Libra 2 and Aura H2O.

Sungray avatar Feb 24 '22 07:02 Sungray

Same problem here, but everytime I open the book, it goes back to the beginning of the chapter. It is very annoying.

What's the format of your book ? Is it kepub or epub ? It must be kepub to work well.

Thovi98 avatar Feb 24 '22 07:02 Thovi98

Ah. It is epub. I can transform all my books I guess :D.

Sungray avatar Feb 24 '22 07:02 Sungray

Converting all books to KEPUB fixed all issues for me - the popup is gone and I can pick up at the correct page. All Good.

Sungray avatar Feb 24 '22 07:02 Sungray

I'm experiencing this issue on a Kobo Clara HD as well. Is there a fix or workaround that doesn't involve converting all books to KEPUB? I'd be happy with just turning the progress sync feature off as well, if that's possible (or, if it would be accepted, I can PR an option for that).

Edit, after some more investigation: I think this may be an int vs float issue. Looking at the incoming PUT request after I lock my ereader, it contains lines like "ContentSourceProgressPercent": 27,. However, when I unlock and look at the GET, it looks like "ContentSourceProgressPercent": 27.0,. My hunch is that this decimal point is throwing the ereader off, causing the notification to display.

bo0tzz avatar Mar 03 '22 13:03 bo0tzz

After some poking around and intercepting requests, I think my analysis above was wrong. Even if I edit the intercepted responses to remove the trailing decimal on the mentioned fields, I still get the issue. I'm more inclined to think this is a bug on the Kobo side, more so because the first report of this issue seems to coincide with a new firmware release. (And it seems like the recent 4.31 update is particularly buggy, according to people on mobileread).
However, blocking the request to calibre-web does seem to prevent the issue, so there is some interaction there.

I might try downgrading my firmware to see if that resolves the issues. If anybody has other ideas for testing, I'd be happy to have another poke at things :)

bo0tzz avatar Mar 05 '22 21:03 bo0tzz

Converting all books to KEPUB fixed all issues for me - the popup is gone and I can pick up at the correct page. All Good.

Hmm, for some reason I was under the impression that Calibre Web actually converts the books for you. For instance, I thought that only KEPUBs were allowed to be used in Calibre sync, and I never convert my EPUBs on Calibre, but they still sync correctly.

So, I thought that Calibre Web converted the books before the sync.

manzaloros avatar Mar 12 '22 16:03 manzaloros

Calibre-Web only uses Kepubify to convert epubs to kepubs not calibre itself (I not sure if this was possible at time of the implementation of the calibre convert function). If "Kepubify" is configured than the books are converted, otherwise not

OzzieIsaacs avatar Mar 12 '22 17:03 OzzieIsaacs

I have the same issue but with the first libra. Really annoying because accidentally confirming "Sync to the last page read" on the popup, actually moves the progress back by at least a few pages. Also as @manzaloros wrote, i was under impression that Sync does convert the books automatically. For example the book im reading now has the Kepub format in Calibre-web (im not 100% if it was generated or maybe i manually converted it before the sync), but I still experience that issue.

Dinth avatar Mar 19 '22 08:03 Dinth

It would appear as though converting to kepub on the fly is solving my "last page" issue. Now that I know that function/process is a thing.

Only now, how do I get it to convert books I've already added to shelves and downloaded? If I add a new book to a shelf and sync/download it - I can see the task appear and it converts. but how do I do the others? I've tried removing it from the device and the shelf and adding it back, but it's like there's a "memory" somewhere. Is the device caching the original file maybe and not calling for a new download?

macr0dev avatar Jun 21 '22 20:06 macr0dev

To confirm then, is converting to kepub on the fly the only way to avoid the message appearing and the jump-to-first-page issue? There's no way to do this with regular epubs?

How I got it working:

I went to Admin > Edit Basic Configuration > External Binaries

In there I set the Path to Kepubify E-Book Converter to /usr/bin/kepubify - because I'm running this server in Docker which helpfully includes kepubify.

After deleting the books from the Kobo device and 'Force full kobo sync' in Calibre Web, then syncing again, I'm seeing the books behave normally: it reopens at the page I last left off, and I'm not prompted each time.

mendhak avatar Mar 19 '23 11:03 mendhak

To confirm then, is converting to kepub on the fly the only way to avoid the message appearing and the jump-to-first-page issue? There's no way to do this with regular epubs?

There is apparently a difference in the way that epub and kepub track "pages." So kepub is the only way to not get the popup and jumping back problem when sycing to a kobo.

macr0dev avatar Mar 20 '23 15:03 macr0dev

I am getting this issue , but I have always been using kepubs ?

jimbobjonesbob avatar Sep 30 '23 21:09 jimbobjonesbob