![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 135428
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen, Kindle PW6
|
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). |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,320
Karma: 27111242
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.
|
![]() |
![]() |
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 135428
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen, Kindle PW6
|
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.
|
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,320
Karma: 27111242
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.
|
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 135428
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen, Kindle PW6
|
During testing, I accidentially deactivated "update metadata in saved copies". So here's an update of the second screenshot (book).
|
![]() |
![]() |
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,680
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#7 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 135428
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen, Kindle PW6
|
Quote:
|
|
![]() |
![]() |
![]() |
#8 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,320
Karma: 27111242
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.
|
![]() |
![]() |
![]() |
#9 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 202
Karma: 135428
Join Date: Oct 2011
Location: Germany (south-west)
Device: Kobo Libra 2 & Clara 2E, Tolino shine 5th Gen, Kindle PW6
|
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.) |
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,320
Karma: 27111242
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.
|
![]() |
![]() |
![]() |
#11 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,974
Karma: 168961900
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?
|
![]() |
![]() |
![]() |
#12 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,320
Karma: 27111242
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 | Thread Starter | Forum | Replies | Last Post |
Make Calibre Content Server to serve the original EPUBs | cedhax | Related Tools | 4 | 02-23-2020 12:29 PM |
calibre-sync: Automatically download books from your Calibre Content Server onto Kobo | mishagale | Related Tools | 14 | 05-13-2019 05:18 PM |
Aura H2O Font size mismatch (downloaded epubs via Calibre vs. Kobo epubs & articles) | Oolong | Kobo Reader | 36 | 01-25-2019 06:00 AM |
Download ePubs from calibre content server without Stanza? | barium | Apple Devices | 18 | 06-18-2012 07:29 AM |
Calibre Server - Fetch Newspaper epubs via rss | Spindoctor | Calibre | 2 | 02-15-2012 11:50 AM |