01-10-2025, 08:52 AM | #1 |
Groupie
Posts: 190
Karma: 135426
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen
|
EPUBs from calibre and calibre-server differ
I noticed that the exported EPUB from calibre and the downloaded EPUB from calibre-server differ. It's always content.opf that differ, maybe because calibre (desktop) always updates that part during export and calibre-server doesn't?
I would like to know whether it is possible to get identical results (which would be good for koreader sync of reading positions). |
01-10-2025, 09:27 AM | #2 |
creator of calibre
Posts: 44,766
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre-server also updates metadata when exporting. What exactly is the difference use the calibre diff tool to check.
|
01-10-2025, 09:46 AM | #3 |
Groupie
Posts: 190
Karma: 135426
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen
|
I depends. Sometimes it's just the different position (line) in the content.opf. In that case, I did a "update metadata in the book files" beforehand. And sometimes one differs in rec_index or still contains (deleted) custom column data. I've attached two diff-screenshots.
|
01-10-2025, 10:02 AM | #4 |
creator of calibre
Posts: 44,766
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That's just some lines changing position not an actual difference. For the second screenshot, custom column metadata is deleted presumably because the EPUB is now in a library without that cusotm column.
|
01-10-2025, 11:01 AM | #5 |
Groupie
Posts: 190
Karma: 135426
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen
|
During testing, I accidentially deactivated "update metadata in saved copies". So here's an update of the second screenshot (book).
|
01-10-2025, 11:04 AM | #6 |
Resident Curmudgeon
Posts: 77,433
Karma: 139151278
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
01-10-2025, 11:04 AM | #7 | |
Groupie
Posts: 190
Karma: 135426
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen
|
Quote:
|
|
01-10-2025, 11:16 AM | #8 |
creator of calibre
Posts: 44,766
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Both use the exact same code to update metadata, so I don't see how they could possibly behave differently. Most likely updating metadata will shuffle some lines around since it works by first deleting metadata entries to reset and then creating them. Trying to make the updates in place or avoid the deletes completely is way too much work for me, patches welcome. KOReader really should be hashing only the spine and the actual content files, not the entire epub. Indeed simply unpacking and repacking an epub can yield a file with a different hash, but identical actual contents. This is because EPUB is a zip container and zip stores unused per file metadata such as timestamps. File has is absolutely the wrong way to be checking for file equality with EPUB.
|
01-10-2025, 01:56 PM | #9 |
Groupie
Posts: 190
Karma: 135426
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen
|
I understand your point about the hashes and absolutely agree. But if I export the book 10x with Calibre (desktop), I get the same file (same hash A) each time. And if I download it 10 times via Calibre (server), I also get the slightly different file 10 times identically (same hash B). Hence my assumption that something is different after all.
(Regarding KOReader, I could use not the binary based hash but filename based hash. But then the hassle starts to get them equal, and I can't configure the calibre-server "offered" filename at all.) |
01-10-2025, 07:17 PM | #10 |
creator of calibre
Posts: 44,766
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Like I said they both use the exact same code, indeed updating metadata in EPUB files is implemented in only one place in all of calibre. You are likely seeing changes becuase of metadata update itself not being byte identical even when nothing is actually changed.
|
01-10-2025, 07:21 PM | #11 |
Bibliophagist
Posts: 41,929
Karma: 161810714
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Perhaps Polish or ModifyEpub could be used to update the metadata in the library copy so the copy being sent does not need to be updated?
|
01-10-2025, 07:24 PM | #12 |
creator of calibre
Posts: 44,766
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The problem is the update happens regardless. And updating will change the file in the "byte identical" sense even if the actual metadata doesnt change.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Make Calibre Content Server to serve the original EPUBs | cedhax | Related Tools | 4 | 02-23-2020 01:29 PM |
calibre-sync: Automatically download books from your Calibre Content Server onto Kobo | mishagale | Related Tools | 14 | 05-13-2019 06:18 PM |
Aura H2O Font size mismatch (downloaded epubs via Calibre vs. Kobo epubs & articles) | Oolong | Kobo Reader | 36 | 01-25-2019 07:00 AM |
Download ePubs from calibre content server without Stanza? | barium | Apple Devices | 18 | 06-18-2012 08:29 AM |
Calibre Server - Fetch Newspaper epubs via rss | Spindoctor | Calibre | 2 | 02-15-2012 12:50 PM |