Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 09-05-2009, 08:16 AM   #1
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,406
Karma: 305065800
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
ePub Zip/Unzip AppleScript application for Mac OS X

Zipping a folder of files to make an ePub isn't as easy — the folder needs to be zipped in a specific way.

Here's an AppleScript application that does all the hard work for you. Just drag the folder of files onto the Applescript application, and your epub will be created.

For later versions of MacOS, permissions need to be given:

Quote:
After downloading, make sure it will launch by double-clicking the icon. You may have to option-right-click-open it, since it's not signed by a known developer. Once it'll launch OK, quit, and drag an epub onto it. It will ask for more permissions, to do with the Finder.

Once all permission have been given, it should just work.
For those interested in what's going on, it's just issuing two zip commands to create the epub, one that zips up the mimetype file without compression, and the second that zips up the rest of the files with compression, skipping the mimetype file and any .DS_Store files or empty directories. The actual commands are

zip -X0 <quoted form of ePubFilePath> mimetype
zip -rDX9 <quoted form of ePubFilePath> * -x "*.DS_Store" -x mimetype

Thanks to Abecedary and Jellby for help getting the magic incantations right.

Comments, bug report, etc, welcome.

New in Version 2.0!
Unzipping an ePub is relatively easy. But it could be easier. This application now unzips ePubs for you, and in addition, it resets the file permissions on the unziped files. No more unzipping an ePub only to find that you don't have permission to read any of the files!

The actual commands used to unzip are:
zip -FF <quoted form of ePubFilePath> --out <quoted form of tempFilePath>
unzip <quoted form of tempFilePath> -d <quoted form of outputFolder>
chmod -R 755 <quoted form of outputFolder>

The application now zips folders into ePubs and unzips ePubs into folders. Drag & Drop or just double-click to run and choose a folder or an ePub.

The new application also has a neat icon, and a crude translation into French. Corrections to the translation very much welcome, as are translations into other languages.

When unzipping, the 2.1 script first uses the zip command to fix any possible errors in the structure of the zip file.



Version 2.0.1: Added german translation by shorshe
Version 2.1: Make sure the zip is good before unzipping it.
Version 2.1.1: Added Portugese translation by PageLab

Version 3.0: Option to expand to a package for use with iBooks.
Version 3.0 (64-bit): For Mac OS X 10.6 and later.
Attached Files
File Type: zip ePub Zip:Unzip 2.1.1.app.zip (191.9 KB, 15531 views)
File Type: zip ePub Zip:Unzip 3.0.zip (205.8 KB, 10796 views)
File Type: zip ePub Zip-Unzip 64 3.0.zip (253.8 KB, 8177 views)

Last edited by pdurrant; 01-16-2023 at 09:01 AM. Reason: New version 3.0 (64-bit)
pdurrant is offline   Reply With Quote
Old 09-05-2009, 09:07 AM   #2
dgillette.rm
Connoisseur
dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'dgillette.rm knows the difference between 'who' and 'whom'
 
dgillette.rm's Avatar
 
Posts: 95
Karma: 10072
Join Date: Apr 2008
Device: sony
Thanks, I was wondering what my problem was. I would download an epub and safari would unzip it and then I could not read it.
dgillette.rm is offline   Reply With Quote
Old 09-05-2009, 09:13 AM   #3
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,406
Karma: 305065800
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by dgillette.rm View Post
Thanks, I was wondering what my problem was. I would download an epub and safari would unzip it and then I could not read it.
To stop Safari doing that, uncheck 'Open "safe" files after downloading' in Safari preferences.
pdurrant is offline   Reply With Quote
Old 09-05-2009, 05:47 PM   #4
Abecedary
Exwyzeeologist
Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.
 
Abecedary's Avatar
 
Posts: 535
Karma: 3261
Join Date: Jun 2009
Device: :PRS-505::iPod touch:
Thanks very much (again)! Seems to work perfectly for me so far. And it makes good sense to put the .DS_Store files on the exclude list (though having that other command aliased is handy for quickly clearing those files off thumb drives, etc--I suppose it would be easy to make a droplet for that, too). Cheers!
Abecedary is offline   Reply With Quote
Old 09-05-2009, 06:07 PM   #5
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Does "-x .DS_Store" catch the files in the subdirectories too?
Jellby is offline   Reply With Quote
Old 09-05-2009, 06:10 PM   #6
Abecedary
Exwyzeeologist
Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.
 
Abecedary's Avatar
 
Posts: 535
Karma: 3261
Join Date: Jun 2009
Device: :PRS-505::iPod touch:
Quote:
Originally Posted by Jellby View Post
Does "-x .DS_Store" catch the files in the subdirectories too?
I would think it'd exclude them recursively, but that's a good question. I'll check on that right now.

EDIT: And no, apparently it doesn't.
Abecedary is offline   Reply With Quote
Old 09-06-2009, 04:16 AM   #7
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Abecedary View Post
I would think it'd exclude them recursively, but that's a good question. I'll check on that right now.

EDIT: And no, apparently it doesn't.
Try with "-x *.DS_Store" then...
Jellby is offline   Reply With Quote
Old 09-06-2009, 08:46 AM   #8
Abecedary
Exwyzeeologist
Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.Abecedary could sell banana peel slippers to a Deveel.
 
Abecedary's Avatar
 
Posts: 535
Karma: 3261
Join Date: Jun 2009
Device: :PRS-505::iPod touch:
Quote:
Originally Posted by Jellby View Post
Try with "-x *.DS_Store" then...
That seems to do it!
Abecedary is offline   Reply With Quote
Old 09-17-2009, 05:34 PM   #9
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,406
Karma: 305065800
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
I've just uploaded a new version. See the first message in this thread.

Enhancement: 1.0.2 now checks for the presence of an existing zip file, and gives the user the option to replace the file or stop. And the old file really does get replaced, as it's moved to the trash before the new one is created. Previously, files left over from the old file could end up being left in the new file.

Quote:
Originally Posted by pdurrant View Post
Here's an AppleScript application that does all the hard work for you - just drag the folder of files onto the Applescript application, and your epub will be created.
pdurrant is offline   Reply With Quote
Old 10-14-2009, 08:58 PM   #10
BookLoverToo
Enthusiast
BookLoverToo doesn't litterBookLoverToo doesn't litter
 
Posts: 40
Karma: 104
Join Date: Mar 2009
Device: Sony PRS-505
Thanks pdurrant. Works like a charm!
BookLoverToo is offline   Reply With Quote
Old 02-26-2010, 05:42 AM   #11
kiermel
Enthusiast
kiermel began at the beginning.
 
kiermel's Avatar
 
Posts: 43
Karma: 10
Join Date: Apr 2009
Location: Malaga - Spain
Device: Kindle Touch, iPad, iPhone
Thumbs up

Thank you very much

I had been trying to create something seemed, and I could not do it!
kiermel is offline   Reply With Quote
Old 03-10-2010, 05:03 PM   #12
MarcusStringer
Member
MarcusStringer began at the beginning.
 
MarcusStringer's Avatar
 
Posts: 21
Karma: 14
Join Date: Sep 2009
Location: Maryborough, Vic, Australia
Device: Adobe Digital Editions
You sir...are a gentleman among men...thank you so much for this I was about ready to slip into a coma yesterday when I couldn't work out why this wasn't working....
MarcusStringer is offline   Reply With Quote
Old 03-24-2010, 08:29 PM   #13
Croptop
Zealot
Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.Croptop ought to be getting tired of karma fortunes by now.
 
Posts: 138
Karma: 1018434
Join Date: Nov 2009
Device: Kobo Elipsa, Kobo Aura One, Pixel 5
Quote:
Originally Posted by pdurrant View Post
Here's an AppleScript application that does all the hard work for you - just drag the folder of files onto the Applescript application, and your epub will be created.
I know that this is an old thread but I wanted to post a big thank you to the OP for making this script available and, more importantly to me, taking the time to explain what the problem is and how it was being solved. Thanks to you and posters on other threads, I can enjoy my purchased .epub books on all of my devices.
Croptop is offline   Reply With Quote
Old 06-17-2010, 07:04 AM   #14
Fabe
Dylanologist
Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.Fabe has survived committing the World's Second Greatest Blunder.
 
Fabe's Avatar
 
Posts: 200
Karma: 146754
Join Date: Apr 2010
Location: Hanover, New Hampshire, USA
Device: none/all/any
Thank you. I've been driving myself nuts trying to properly zip files for epub on my Mac. Thank you, thank you, thank you.
Fabe is offline   Reply With Quote
Old 07-31-2010, 05:15 PM   #15
David Derrico
Connoisseur
David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.David Derrico ought to be getting tired of karma fortunes by now.
 
David Derrico's Avatar
 
Posts: 59
Karma: 510132
Join Date: Dec 2009
Location: South Florida
Device: Kindle 3 & Kobo Wireless
You rock super, super hard! This, and your ePubCheck applescript, saved me so much time and frustration. Thank you!!
David Derrico is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescript Wrapper Application for Kindlegen pdurrant Kindle Formats 50 02-18-2020 01:16 AM
How to unzip a Calibre ZIP file on a Mac? webfolk Calibre 15 06-03-2012 06:01 PM
Useful Applescript for Mac OS X users pdurrant Kindle Formats 11 07-23-2011 05:00 AM
Mobiperl mobi2html changesetR84.zip won't unzip cyberbaffled Kindle Formats 0 06-15-2010 10:25 PM
Mac OS X lit2rtf AppleScript thingy FourOhFour Sony Reader 11 08-11-2007 12:02 AM


All times are GMT -4. The time now is 11:52 AM.


MobileRead.com is a privately owned, operated and funded community.