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 01-05-2011, 12:19 PM   #31
Jim Lester
Evangelist
Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.Jim Lester is less competitive than you.
 
Jim Lester's Avatar
 
Posts: 416
Karma: 14682
Join Date: May 2008
Location: SF Bay Area
Device: Nook HD, Nook for Windows 8
I've automated this a bit by adding the following to my .bash_profile

Code:
#Create ePub file from exploded directory at CWD
# USAGE: zipub Path  (shouldn't be under CWD)  ie do zipub ../test.epub
zipub () {
    zip -X0 $1 mimetype
    zip -rDX9 $1 * -x "*.DS_Store" -x mimetype
}
Jim Lester is offline   Reply With Quote
Old 02-05-2011, 07:15 PM   #32
ronmartinez
Junior Member
ronmartinez began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2011
Location: San Francisco
Device: iPad
Quote:
Originally Posted by MichaelGray View Post
Hi there
Hope somebody can help with this - I've been using ePub zip for a while and it's been a fantastic saviour, but suddenly it doesn't seem to work any more. When I try to zip my folder into epub I get an error message: "Can't make <<class ctnr>> of item 1 {alias "Macintosh HD:Users:Mini25esktop:nameofmyfolder:"} into type text." I can OK this or press an "Edit" button, which opens the Apple Script Editor (beyond me!)
Not sure what changed on my system or in my epub - it just seems to have changed from one day to the next. Any ideas?
Thanks very much
Michael
Hi! Not sure if you've gotten this sorted out. I had the same experience with this wonderfully useful script when I tried to use it on a different machine (Mac Pro, fine, Macbook, exact same error). Odd.

I was able to work around it with a hack to the Applescript. It's not a fix, just a way to keep working. You're going to delete the troublesome code and hardwire the result it's attempting to produce - a path (i.e., location on your hard drive) to place the finished ePub file.

The steps:

- Open the script in the Applescript Editor
- Run the script from the Editor, using the green run button, and select your ePub folder
- It should fail with error message once you have selected the folder
- Note at the bottom of the Editor there is an Event Log. You should see something like this:

error "Can’t make «class ctnr» of alias \"home:Users:ronmartinez:a_yo_iBookC:\" into type text." number -1700 from «class ctnr» of alias "home:Users:ronmartinez:a_yo_iBookC:" to text

(The error apparently has something to do with the attempt to re-type the alias so it can be used in a variable. Needs some investigation and puzzling out, but this is happening in the 5th line of the script:

set ePubParent to (container of ePubFolder) as text

The workaround: hardwire the ePubParent variable. This will be the location your newly created ePub will be placed in. To do the hardwiring, you'll put a properly formatted path into the variable. I just used the same folder the ePub is in, but you can use another.)

- Note the correct form of the path in the second line of your error message in the Event Log. In my example:

"home:Users:ronmartinez:a_yo_iBookC:"

- Copy that string of text, including the quotes.
- Replace the troublesome line 5 with a line of text that says the following:

set ePubParent to "home:Users:ronmartinez:a_yo_iBookC:"

Of course, using your own path, and not my example path!

- Save As the script with a new name.
- Run the script
- It should work, and deposit the finished ePub at the destination indicated by the path. Note that you can use any destination folder on your hard drive volume, as long as the proper format is used.

Hopefully this helps. Back up your work before you do anything, natch. But should be pretty innocuous, and hopefully provides the OP with some clues as to the bug. (And thank you for this script, again!).

- Ron
ronmartinez is offline   Reply With Quote
 
Enthusiast
Old 02-11-2011, 05:49 AM   #33
MichaelGray
Member
MichaelGray began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Feb 2010
Device: None
Thanks Ron
I've slightly lost track of what happened, but as it's working again now and I can't remember what (if anything) I ended up doing to fix it (maybe I downloaded anew?) Perhaps it was just having a bad day. It's a great script I use a lot despite the odd hiccup –*thanks for you reply though!
Michael
MichaelGray is offline   Reply With Quote
Old 02-12-2011, 12:17 PM   #34
Fern
private investigator
Fern began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2011
Device: Kindle iPhone
Thanks a lot pdurrant for the little app! It works beautifully!

Now, just out of curiosity (and because I'm interested in learning the nuts and bolts of the epub creation process), if I were to do in Terminal what your app does for me, which commands wound I have to enter? The ones in the first post of this thread don't seem to work. Sorry, I'm a UNIX noob. I keep getting messages such as "name not matched: mimetype" or "zip error: Nothing to do!"
Fern is offline   Reply With Quote
Old 02-12-2011, 04:18 PM   #35
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: 30,646
Karma: 85135660
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by Fern View Post
Now, just out of curiosity (and because I'm interested in learning the nuts and bolts of the epub creation process), if I were to do in Terminal what your app does for me, which commands wound I have to enter? The ones in the first post of this thread don't seem to work. Sorry, I'm a UNIX noob. I keep getting messages such as "name not matched: mimetype" or "zip error: Nothing to do!"
If you use Script Editor to open the script up, you'll be able to see exactly what commands are needed and how they're issued. It's quite a bit of hassle to issue them manually, especially as you need to escape path and file names that contain spaces and other awkward characters.
pdurrant is offline   Reply With Quote
Old 02-13-2011, 05:15 AM   #36
Fern
private investigator
Fern began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2011
Device: Kindle iPhone
Quote:
Originally Posted by pdurrant View Post
If you use Script Editor to open the script up, you'll be able to see exactly what commands are needed and how they're issued.
Thanks for the tip pdurrant. Just shows I have still a lot to learn before I can mess around in Terminal. Great stuff!
Fern is offline   Reply With Quote
Old 04-07-2011, 04:53 PM   #37
noteon
Member
noteon is on a distinguished road
 
Posts: 19
Karma: 54
Join Date: Apr 2011
Location: NYC
Device: Kindle
Evening!

Thanks for making these scripts available. I've got a head-scratcher with ePub Zip that I'm hoping someone recognizes. I've unzipped an ePub with ePub Unzip, did a GREP alteration of some div tags in Text Wranger, and when I try to zip it back up, I get this:

zip warning: name not matched: mimetype
zip error: Nothing to do! (/Users/keithsnyder/Desktop/OEBPS.epub)

I'm certain I didn't alter anything but the div tags; what else could be causing this?

Thanks!

(MacOS 10.5.8, Intel Core 2 Duo)

EDIT: I'm an idiot. I was trying to zip the contents of the folder instead of the folder itself. Never mind...

Last edited by noteon; 04-07-2011 at 05:04 PM.
noteon is offline   Reply With Quote
Old 08-09-2011, 03:33 PM   #38
dejiridoo
Junior Member
dejiridoo began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle
Thumbs up Converter App Worked like a charm

Quote:
Originally Posted by pdurrant View Post
Extracting the files from an ePub is easy - you can just unzip the file and then you get a folder full of the contents of the ePub.

But zipping the folder of files back up into an ePub isn't as easy - it 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 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 "full path to new epub file" mimetype

and

zip -rDX9 "full path to new epub file" * -x "*.DS_Store" -x mimetype

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

Comments, bug report, etc, welcome.

Edit: Bug Fix 1: Using Jellby's suggestion, 1.0.1 now excludes .DS_Store files in subdirectories too

Edit: 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.
Fantastic. I had the same problem after trying to edit an EPUB. I successfully edited the book but then when I rezipped, I encountered many problems. (Oddly enough, Calibre could read it.) This little tool instantly solved my problem. Thanks so much for all your help -- one year after you posted.
dejiridoo is offline   Reply With Quote
Old 08-31-2011, 06:55 AM   #39
MignonK
Junior Member
MignonK can extract oil from cheeseMignonK can extract oil from cheeseMignonK can extract oil from cheeseMignonK can extract oil from cheeseMignonK can extract oil from cheeseMignonK can extract oil from cheeseMignonK can extract oil from cheeseMignonK can extract oil from cheeseMignonK can extract oil from cheese
 
Posts: 2
Karma: 1234
Join Date: Aug 2011
Device: none
It is a great little tool, thank you.
And my rezipped ePub is working in the various readers I've been working with (Bookworm, Calibre, Ibis) but is now crashing Adobe Digital Editions (the original ePub file doesn't do that). Wondering if anyone else is experiencing this and what the problem may be.
MignonK is offline   Reply With Quote
Old 08-31-2011, 12:41 PM   #40
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: 30,646
Karma: 85135660
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by MignonK View Post
It is a great little tool, thank you.
And my rezipped ePub is working in the various readers I've been working with (Bookworm, Calibre, Ibis) but is now crashing Adobe Digital Editions (the original ePub file doesn't do that). Wondering if anyone else is experiencing this and what the problem may be.
The problem is probably in one of the bits you changed. So look there first. (It's probably also worth checking that the new version passed epubcheck, not that passing or failing epubcheck actually indicates whether any particular renderer will render it well.)
pdurrant is offline   Reply With Quote
Old 09-18-2011, 09:59 AM   #41
deb248211
Junior Member
deb248211 doesn't litterdeb248211 doesn't litterdeb248211 doesn't litter
 
Posts: 1
Karma: 202
Join Date: Sep 2011
Device: Android tablet
Thank you so much for the Applescript - I agree with David Derrico - you definitely rock super, super hard!

I'd spent the morning trying various zip commands, resulting in failed epubs, but now all is well. You are a star!
deb248211 is offline   Reply With Quote
Old 11-21-2011, 06:13 PM   #42
creativeshark
Junior Member
creativeshark began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Nov 2011
Device: none
I downloaded the zip 1.02 script app, but I've not yet found the unzip 1.0 script app... I've been watching the training videos on Lynda.com but don't have access to the exercise files and scripts and they recommend this site! Can someone please point me to the download link... ty so much in advance!
creativeshark is offline   Reply With Quote
Old 11-21-2011, 06:43 PM   #43
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 6,024
Karma: 14748740
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International & Sony PRS-T1
Quote:
Originally Posted by creativeshark View Post
I downloaded the zip 1.02 script app, but I've not yet found the unzip 1.0 script app...
You don't need an special unzip script. ePubs are just ordinary zip files, arranged in a certain way. You can unzip them using your regular unzip tool ("unzip" in the Terminal, or just add a .zip extension to the filename and double-click in the Finder).

Hope this helps, and welcome to MobileRead!
ATDrake is offline   Reply With Quote
Old 11-22-2011, 12:18 AM   #44
danrodney
All Around Nice Guy
danrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of itdanrodney has read War And Peace ... all of it
 
Posts: 21
Karma: 66666
Join Date: Oct 2010
Location: New York City
Device: iPad, iPhone, Kindle Keyboard, Kindle Fire, Nook 1st Gen, Nook Color
Quote:
Originally Posted by ATDrake View Post
You don't need an special unzip script. ePubs are just ordinary zip files, arranged in a certain way. You can unzip them using your regular unzip tool ("unzip" in the Terminal, or just add a .zip extension to the filename and double-click in the Finder).

Hope this helps, and welcome to MobileRead!
The Finder doesn't always properly unzip scripts, and it's tedious renaming files or using the Terminal. I wrote the unzip script to make it faster and it always works. So to answer the question of where to download the unzip script. It's here (on page 2 of this thread):
http://www.mobileread.com/forums/sho...4&postcount=19
danrodney is offline   Reply With Quote
Old 01-11-2012, 08:44 PM   #45
Bretperry
Junior Member
Bretperry began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2012
Device: iPod Touch, Kindle Fire
Super script, great for InDesign too.

danrodney,,

Love this script. On a Mac, and thought I was going to have to buy Oxygen ($$$) just to fix epubs.

This does all I need for now!

Even better, it works great with InDesign CS5 .idml files (under the hood, a flavor of epub).

Do you mind if I adapt it to make a script that fixes "stuck" unused colors in InDesign (you save as .idml, edit the graphics file and re-open)?

Shall I credit you in the scripts header, want a link to this or just your name?
Bretperry 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 20 Yesterday 05:29 PM
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 10:27 PM.


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