Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calibre plugin - books send to devices differ by several bytes #6491

Closed
Galunid opened this issue Aug 10, 2020 · 9 comments
Closed

Calibre plugin - books send to devices differ by several bytes #6491

Galunid opened this issue Aug 10, 2020 · 9 comments
Labels
can't fix an issue that, by definition, cannot be fixed Plugin Upstream

Comments

@Galunid
Copy link
Member

Galunid commented Aug 10, 2020

  • KOReader version: latest nightly
  • Device: Kobo Clara HD, Kobo Libra H2O

Issue

When sending books to two different ereaders, both may come with different filesize. For example book send to my Kobo Clara HD has 21,642,800 bytes, while one send to Libra has 21,642,803 bytes. They differ by 3 bytes, which wouldn't really matter, if it wasn't for different partial hashes. Because of this it's not possible to sync those books between devices. It happens both with .pdf and .epub files, but probably with others too.

Steps to reproduce

Connect device1 to calibre server. Send books. Disconnect device. Repeat for device2.

crash.log (if applicable)

crash.log doesn't contain anything useful in this case.

@Galunid
Copy link
Member Author

Galunid commented Aug 10, 2020

Books transferred from Calibre via USB have 21,642,803 bytes, there was one instance where book send via calibre wireless plugin had 21,642,804 bytes, which is more than the ones send via USB.

@pazos
Copy link
Member

pazos commented Aug 10, 2020

@Galunid: calibre reports the length in bytes of the file it is going to send. See https://github.com/koreader/koreader/blob/master/plugins/calibre.koplugin/wireless.lua#L500.

Please add a few log statements and see it the origin file matches the length that calibre announces. If they match then probably is something in https://github.com/koreader/koreader/blob/master/plugins/calibre.koplugin/wireless.lua#L523-L562.

I'm not to bothered to look at it, so please give a try if you wish 👍

@pazos pazos added help-wanted We'd like help with this issue Plugin labels Aug 10, 2020
@Galunid
Copy link
Member Author

Galunid commented Aug 10, 2020

I took a look and 3 different times calibre reported 3 different sizes, so I guess plugin is ok, but there is something wrong with calibre.

@NiLuJe
Copy link
Member

NiLuJe commented Aug 10, 2020

Calibre updates metadata on-the-fly during the Send process (true for USB, no idea about Wireless). Getting bit-exact files out of it is not going to work, ever, AFAIU.

(Except for the Content server, maybe?)

@Galunid Galunid changed the title Calibre plugin - books send to devices differ by server bytes Calibre plugin - books send to devices differ by several bytes Aug 10, 2020
@Galunid Galunid added can't fix an issue that, by definition, cannot be fixed Upstream and removed help-wanted We'd like help with this issue labels Aug 10, 2020
@pazos
Copy link
Member

pazos commented Aug 10, 2020

Mmm, maybe there's a way to do that from calibre itself or using some flag on init but I have no idea. Probably the fastest way to know is asking to u/chaley on mobileread. He solved me quite a few questions in https://www.mobileread.com/forums/showthread.php?t=330205

@pazos
Copy link
Member

pazos commented Aug 18, 2020

Closing for the moment, feel free to reopen if it is fixable at all!

@pazos
Copy link
Member

pazos commented Jan 29, 2021

@Galunid: I got this thread -> https://www.mobileread.com/forums/showthread.php?t=285916

Maybe disabling "keep a copy of annotations and bookmarks inside the book, to share" in calibre viewer would prevent calibre from modifying the book copy it delivers to the device. ¿? I don't know as I never use the calibre viewer.

In the same thread they comment there's also a similar setting to use with "save to disk" feature.

@Galunid
Copy link
Member Author

Galunid commented Jan 29, 2021

Thanks, I'll check it out. For now, I send all the books to both devices. I assume the first time I send it, calibre generates the file, the second time it just sends the already generated file. After restarting calibre will have to recreate the file, thus the few bytes of difference. I don't use calibre viewer too, so no clue if it's related to that. I've found the setting so we will see.

@Galunid
Copy link
Member Author

Galunid commented Jan 29, 2021

@pazos tested disabling Preferences -> Miscalleneous -> Keep a copy of annotations/bookmarks in e-book file, for easy sharing in Calibre viewer and it seems to do the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't fix an issue that, by definition, cannot be fixed Plugin Upstream
Projects
None yet
Development

No branches or pull requests

3 participants