View Single Post
Old 08-16-2016, 06:37 AM   #21
keba
Junior Member
keba began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Aug 2012
Device: Kobo Aura H2O
To answer your 2 questions:

The Calibre plugin didn't work, and since I have no clue how to create a calibre plugin, I decided to simply run the script from the command line. There, I hit the problem of not actually having Python 2 installed, so I was forced to translate your script. Also, I'm not very familiar with Python 2, so some of the encoding/decoding to and from byte arrays were a bit of a mystery to me.

As you can see in the script, I had to duplicate the 2 functions readFile() and readString() because the manifest (now called _version_) uses a different encoding (plain UTF-8 text) than the actual content of the bibles (the stuff actually in need of decoding).

UTF-8:
In readString2(), which reads the actual .yves-files, the problem was that the chr() function didn't provide the required results, so I had to create a byte-array before being able to decode it into UTF-8. I assume this may also be a Python 3 specific problem though:

Code:
byteArray2 = bytearray((x & 0xFF) for x in byteArray)
return(byteArray2.decode("utf8"))
And finally, it appears that some .yves-files contain html embedded in JSON, while others provide plain html. So I added a check for JSON, and if that is found it extracts the html, otherwise it uses the plain decoded html.

Does that answer all your questions?
keba is offline   Reply With Quote