View Single Post
Old 10-08-2014, 08:50 AM   #1018
tkeo
Connoisseur
tkeo began at the beginning.
 
Posts: 94
Karma: 10
Join Date: Feb 2014
Location: Japan
Device: Kindle PaperWhite, Kobo Aura HD
Hi Kevin,

I have modified the code; however, I am not sure that they are proper way to fix.
I attach the patch. (Due to the setting of my IDE many, differences of spaces at the end of lines are included.)

I have not tested ehough; but I see a few bugs still.

1. krzyzacy-tom-pierwszy.mobi (some one posted here)

got an error with python 3:

Spoiler:
Unpacking Book...
Palm DB type: BOOKMOBI, 767 sections.
Unpacking a Combination M8/KF8 book...
Processing Mobipocket 6 section of book...
Mobi Version: 6
Codec: utf-8
Title: Krzyナシacy, tom pierwszy
EXTH Title: Krzyナシacy, tom pierwszy
Palmdoc compression
Unpacking images, resources, fonts, etc
Extracting image: cover00346.jpeg from section 346
Extracting image: image00347.jpeg from section 347
Extracting image: image00348.jpeg from section 348
Extracting image: image00349.jpeg from section 349
Extracting font: font00350
Extracting font: font00351
Extracting font: font00352
Unpacking raw markup language
Write ncx
Find link anchors
Insert data into html
Insert hrefs into html
Remove empty anchors from html
Insert image references into html
Building an opf for mobi7/azw4.
Processing K8 section of book...
Mobi Version: 8
Codec: utf-8
Title: Krzyナシacy, tom pierwszy
EXTH Title: Krzyナシacy, tom pierwszy
Palmdoc compression
Unpacking images, resources, fonts, etc
Unpacking raw markup language
Processing ncx / toc
Building an epub-like structure
Building proper xhtml for each file
Building a cover page.
Building an opf for mobi8 using epub version: 2
Write K8 ncx
Creating an epub-like file
Traceback (most recent call last):
File "kindleunpack.py", line 1022, in <module>
sys.exit(main())
File "kindleunpack.py", line 1010, in main
unpackBook(infile, outdir, apnxfile, epubver, use_hd)
File "kindleunpack.py", line 922, in unpackBook
process_all_mobi_headers(files, apnxfile, sect, mhlst, K8Boundary, False, ep
ubver, use_hd)
File "kindleunpack.py", line 839, in process_all_mobi_headers
processMobi8(mh, metadata, sect, files, imgnames, pagemapproc, k8resc, obfus
cate_data, apnxfile, epubver)
File "kindleunpack.py", line 597, in processMobi8
files.makeEPUB(usedmap, obfuscate_data, uuid)
File "D:unpack_structure.py", line 128
, in makeEPUB
data = mangle_fonts(key, data)
File "mobi_utils.py", line 173, in m
angle_fonts
encrypt = b''.join([bchr(bord(x)^next(key)) for x in crypt])
File "mobi_utils.py", line 173, in <
listcomp>
encrypt = b''.join([bchr(bord(x)^next(key)) for x in crypt])
TypeError: ord() expected string of length 1, but int found


2. HDimage_test.mobi

With python 3, content.opf is not properly constructed.
I attach the diff of content.opf v0.75 vs v0.80 on python 3.
EDIT
It is correctly constructed after reversed mobi_opf.py.
I remove the diff.

3. test1.azw3

With python3, the cover page is inserted incorrectly.

Spoiler:
<item id="inserted" media-type="application/xhtml+xml" href="Text/cover_page.xhtml" />
<item id="x_p-cover" media-type="application/xhtml+xml" href="Text/part0000.xhtml" />


Take care,

EDIT
I have replaced the patch file.
Attached Files
File Type: zip nlib.patch.zip (4.5 KB, 250 views)

Last edited by tkeo; 10-08-2014 at 09:41 AM. Reason: replaced the attached file
tkeo is offline   Reply With Quote