EpubWriter: use the mtime option as the date_time value of zip metadata
Hello there, thanks for this great library.
This pull-request changes sligthly the logic to reuse the "mtime" option as the zip-file metadata "date_time".
As I was generating multiple times the same epub with the exact same content, i was surprised to see that md5 hashes weren't matching for successive generations.
the zipfile library takes a new timestamp at each use of the writestr method to set the "date_time" metadata corresponding to the last modification of the zip file.
This pull requests:
- sets a new datetime in the
mtimeoption when initializing a new EpubWriter object - lets this option still be overriden as expected, for the epub metadata
- reuse this
mtimeoption value to fill the metadata of the zip file when writing.
This means:
- the zip file date_time metadata is always aligned with the epub metadata (not very important but i guess it can be nice for consistency)
- when a user sets the
mtimeoption, for the same exact content, the epub file obtained will be exactly the same, byte for byte, allowing reproducible builds.
I guess reproducible builds are not exactly a priority, but this could be useful for testing, publishing, and trusting any tool that uses this library.
Thanks again, i'm waiting for your comments and feedback on this.