View Single Post
Old 04-20-2010, 01:09 PM   #150
EatingPie
Blueberry!
EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.
 
EatingPie's Avatar
 
Posts: 888
Karma: 133343
Join Date: Mar 2007
Device: Sony PRS-500 (RIP); PRS-600 (Good Riddance); PRS-505; PRS-650; PRS-350
Quote:
Originally Posted by epstewart View Post
The problem has to do with the fact that some downloaded Adobe eBook files need to be unzipped and then rezipped again before decrypting them on a Mac. eBooks in the ePub format (even if they are ADEPT-encrypted) are basically ZIP files. They've been zipped into an archive containing a signle folder that holds multiple individual files. The entire archive has been compressed to make it smaller. For some reason, the ineptepub.py decryption software on a Mac can't do the unzipping properly, preparatory to doing the decryption. But if you unzip the archive and then rezip it, you can feed the rezipped version to ineptepub.py and it will work.

The key thing to do seems to be to follow the directions in post #60.

You will work on a copy of your eBook, not the original. I suggest putting the copy on the Desktop. It has to be renamed in Get Info, in the Finder, so that it has a .zip extension replacing .epub. Then, when you double-click the renamed .zip file, the Mac will unzip it into a folder on the Desktop.

Post #60 refers to this post in another thread, in which you will find a downloadable AppleScript "droplet" that you will download and unzip to become an ePub Zip 1.0.2 icon on your Desktop. Then you will drag the unzipped eBook archive, now a folder on your Desktop, to this droplet in order to rezip it. It becomes a file on the Desktop. This file has an .epub extension. You can use this file as the Input File to ineptepub.py.
I found an alternate solution to this problem.

- DOES NOT require unzip/rezip. (The Good News!)
- DOES require the command line. (The Bad News, unless you're me. )

It also eliminates the do not use unzip on the command line warning. An unzip will work fine afterward, though it won't be necessary, since the archive is repaired directly.

Here goes...

The zip file has a corrupted file name in the archive, as mentioned above. The command line version of zip on Mac OS X actually has the ability to repair zip files. Since this is a pretty simple repair, it works fine.

Note that the zip command alters the file in place, so you probably want to work on a copy.

Code:
% cp your-epub.epub new-epub.epub
% zip -F new-epub.epub
To test the archive, you can use the unzip command:

Code:
% unzip -qt new-epub.epub
If the fix worked, you shouldn't see anything. Just a clean run, all clear and back to the prompt. This also doesn't actually unzip anything, it's just a test run.

Okay!!

Now you can run ineptepub.pyw on the fixed file (it has a command-line/no GUI mode when you pass it parameters).

Code:
% python ineptepub.pyw  adeptkey.der new-epub.epub decrypted.epub
% rm new-epub.epub
I wrote a bash script to do the whole shebang, but it's pretty custom in terms of hard-coded directories. It's also against the rules to post here anyway.

This solution should also work via in an Applescript. Wink Wink Nudge Nudge.

-Pie

Last edited by EatingPie; 04-20-2010 at 01:34 PM.
EatingPie is offline   Reply With Quote