Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,15 @@ pages_title "Pages"
spine_direction True
package_direction False
play_order {'enabled': False, 'start_from': 1}
compresslevel 6
================= ====================================

In the future version default value for ignore_ncx will be changed. According to the documentation default
behaviour should be "EPUB 3 Reading Systems must ignore the NCX in favor of the EPUB Navigation Document".
Because we have been doing wrong this all time we will keep the default behavior to prepare for the change.

compresslevel goes from 0 to 9, where 0 is no compression.

Example when overriding default options:

::
Expand Down
5 changes: 3 additions & 2 deletions ebooklib/epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,8 @@ class EpubWriter(object):
'play_order': {
'enabled': False,
'start_from': 1
}
},
'compresslevel': 6
}

def __init__(self, name, book, options=None):
Expand Down Expand Up @@ -1363,7 +1364,7 @@ def _write_items(self):

def write(self):
# check for the option allowZip64
self.out = zipfile.ZipFile(self.file_name, 'w', zipfile.ZIP_DEFLATED)
self.out = zipfile.ZipFile(self.file_name, 'w', zipfile.ZIP_DEFLATED, compresslevel=self.options['compresslevel'])
self.out.writestr('mimetype', 'application/epub+zip', compress_type=zipfile.ZIP_STORED)

self._write_container()
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def read(path):
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development :: Libraries :: Python Modules"
],
install_requires = [
Expand Down