RB Output: Fix calibre generated rb files not being opened by the RocketBook. Fixes #880930 (Fix rb format compression)

This commit is contained in:
Kovid Goyal 2011-10-25 07:09:44 +05:30
commit 8258bbfefb

View File

@ -104,8 +104,9 @@ class RBWriter(object):
size = len(text) size = len(text)
pages = [] pages = []
for i in range(0, (len(text) / TEXT_RECORD_SIZE) + 1): for i in range(0, (len(text) + TEXT_RECORD_SIZE-1) / TEXT_RECORD_SIZE):
pages.append(zlib.compress(text[i * TEXT_RECORD_SIZE : (i * TEXT_RECORD_SIZE) + TEXT_RECORD_SIZE], 9)) zobj = zlib.compressobj(9, zlib.DEFLATED, 13, 8, 0)
pages.append(zobj.compress(text[i * TEXT_RECORD_SIZE : (i * TEXT_RECORD_SIZE) + TEXT_RECORD_SIZE]) + zobj.flush())
return (size, pages) return (size, pages)