noDRM / DeDRM_tools

DeDRM tools for ebooks
7.39k stars 325 forks source link

Unnecessary modifications of DRM-free ebooks #555

Open random-human-being opened 6 months ago

random-human-being commented 6 months ago

Question / bug report

Current behaviour: When adding a DRM-free epub to Calibre, DeDRM uncompresses and recompresses it, regardless of whether any DRM removal is needed.

This results in a different MD5 from the original file.

Unzipping both epubs (the original one, and the one in Calibre's library that has been recompressed by DeDRM) and checking the MD5 of the individual files themselves does not show any difference.

I am adding the relevant lines from Calibre's log below.

Expected behaviour: I have verified that the above did not happen when using the original DeDRM plugin (before the fork): adding an epub where no changes are needed results in an identical MD5 in Calibre's library.

If seems to me the current behaviour is a bug.

Which version of Calibre are you running?

7.11.0

Which version of the DeDRM plugin are you running?

v10.0.9

If applicable, which version of the Kindle software are you running?

No response

Log output

DeDRM v10.0.9: Trying to decrypt xxxxxxxxxxxxxxxxxxxxxxxxxxx.epub
DeDRM v10.0.9: Verifying zip archive integrity
DeDRM v10.0.9: Post-processing took 0.0 seconds
DeDRM v10.0.9: Finished after 0.1 seconds
noDRM commented 3 weeks ago

Thanks for the report, this should be fixed with de3d91f5e53807aa8e029e49b40d4cead3deee79. Can you give that version a try? You can download it from here: https://github.com/noDRM/DeDRM_tools_autorelease/releases

I tested it with a drm-free EPUB and now it doesn't modify the checksum anymore. This was due to the fact that the very first thing the plugin does is run the zipfix code (which re-packs EPUBs) so that the DRM-removal code can deal with slightly corrupted EPUBs as well.

With this change this zipfix code now happens on a temporary copy, and once the plugin has determined it neither has DRM to remove nor fonts or watermarks to fix it will return the original file from before it was modified.