View Full Version : epubcheck for Mac OS X


pdurrant
09-04-2009, 09:59 AM
There's this great epubcheck tool over at http://code.google.com/p/epubcheck/
but it comes as a java application or for a web server. I wanted a drag&drop application for Mac OS X.

So I wrapped the java app in an AppleScript. Here it is. Just drag & drop ePub files onto the AppleScript, and the script will run epubcheck and report back on errors. If there are no errors, you'll also get a small dialog saying so.

I beleive it will work on Mac OS X 10.4 and later.

Feedback welcome.

[EDIT] Updated to use epubcheck 1.0.5

[EDIT] Updated to make the error dialog a bit wider, and to save an error report when there are errors. The error report will be in the same folder as the ePub and with the same name, but with '.txt' appended.

[EDIT] Updated to use epubcheck 1.1. I've left the 1.05 version here in case anyone still needs it.

[EDIT] Updated to use epubcheck 1.2. I've left the previous versions, even though I can't think why anyone would want to use them.

[EDIT] Updated to use epubcheck 3.0b5. Now has a pretty icon and also a translation into French. Thanks to Diegnum for the French translation. Any error in the French will be mine, as I adapted their text slightly. Please do report any errors in the dialogs. Further translations will be added if there is demand, and someone supplies me with the translated text!

[EDIT] Updated to use epubcheck 3.0RC1.

[EDIT] Update to use epubcheck 3.0.

Abecedary
09-04-2009, 11:08 AM
Thanks! I was usually already in Terminal.app after zipping up a file, so typing in another command to fire up epubcheck wasn't a problem. But this just makes everything that much easier! And it seems to work fine on 10.4.11.

pdurrant
09-04-2009, 05:01 PM
What is the magic incantation required in terminal to zip up a folder of files into the correct zip format?

None of my GUI zip utilities will do it right.

Perhaps I could make an AppleScript that you could just a folder on and it would do the zipping. I much prefer small drag&drop apps to remembering and typing terminal commands.

Thanks! I was usually already in Terminal.app after zipping up a file, so typing in another command to fire up epubcheck wasn't a problem. But this just makes everything that much easier! And it seems to work fine on 10.4.11.

Abecedary
09-04-2009, 05:42 PM
I've been thinking about simplifying this in some way, but if you want to make a drag'n'drop script it'll be that much easier on me. :)

The terminal commands to do it are:
zip -X0 bookname.epub mimetype
zip -rX9 bookname.epub * -x mimetype
The first line makes the zip file (with epub extension) with only the mimetype and no compression (the -0 switch). The second line recursively goes through the directory (-r) and adds everything else (the *) to the zip file at maximum compression (-9) while excluding the mimetype file (-x). The -X switch ignores any extra file attributes.

It's not a bad idea to precede the whole thing with this command to clear out the .DS_Store files first:
find . -name '*.DS_Store' -type f -delete
(I have that aliased to 'rmds' in my .profile for typing simplicity.)

Jellby
09-05-2009, 04:55 AM
I add the "-D" option too (do not create entries in the zip archive for directories), and remove the .epub file before zipping.

pdurrant
09-05-2009, 01:12 PM
The AppleScript is ready for testing

http://www.mobileread.com/forums/showthread.php?t=55681

pdurrant
05-28-2010, 03:32 AM
Now updated to use epubcheck 1.0.5

kjk
05-28-2010, 05:06 PM
Will definitely try this out this weekend, thanks!

JAGINAZ
06-12-2010, 10:29 AM
This seems to be what I am looking for. I appreciate the knowledge and the technical expertise that you all have acquired, but I am 'geek speak' illiterate. I have no idea what AppleScript is. Simply stated...I need to run a file through EpubCheck 1.0.5...I have a brand new iMac. When I click on your linc, pdurrant - it downloads but then it is just a file in a list of downloads. Anyone game enough to walk this infant through the rest of the process? Sorry to be so needy.

pdurrant
06-12-2010, 02:25 PM
This seems to be what I am looking for. I appreciate the knowledge and the technical expertise that you all have acquired, but I am 'geek speak' illiterate. I have no idea what AppleScript is. Simply stated...I need to run a file through EpubCheck 1.0.5...I have a brand new iMac. When I click on your linc, pdurrant - it downloads but then it is just a file in a list of downloads. Anyone game enough to walk this infant through the rest of the process? Sorry to be so needy.

The file you download is a .zip (compressed) file. Double-click it and Mac OS X will expand it back to the original size. You now have an application*.

Drag & Drop your ePub onto the application, and it will check it, and display the results in a dialog.

HTH

*The application is written in AppleScript. This is a neat way to get other programs to do things, and ties it up nicely into a simple application. In your Applications folder you probably have an AppleScript folder, inside which is the Script Editor application. You can use this to look at the script used in the epubcheck applescript program if you like. But there's no need unless you're interested.

Basil Bourque
08-17-2010, 08:37 PM
"ePubChecker" is a free easy-to-use program that runs your EPUB file through "epubcheck". Just drag and drop your book file, and click "Check".

Faster than uploading to a web site and more private as you keep your book on your own computer. Runs on Mac OS X 10.4, 10.5, and 10.6.

See the screenshot:
http://www.rainwater-soft.com/epubchecker/

This app is built by my company, but uses the "epubcheck" v1.0.5 checking engine from Google/Adobe as required by Apple when submitting an iBook.

--Basil Bourque

Almiel
08-18-2010, 12:21 AM
What is the magic incantation required in terminal to zip up a folder of files into the correct zip format?


I use this method in terminal:

zip -X MyNewEbook.epub mimetype

zip -rg MyNewEbook.epub META-INF -x \*.DS_Store

zip -rg MyNewEbook.epub OEBPS -x \*.DS_Store

I got it from http://www.webvivant.com/zipping-epub-files.html.

pdurrant
08-18-2010, 02:11 AM
I use this method in terminal:

zip -X MyNewEbook.epub mimetype

zip -rg MyNewEbook.epub META-INF -x \*.DS_Store

zip -rg MyNewEbook.epub OEBPS -x \*.DS_Store

I got it from http://www.webvivant.com/zipping-epub-files.html.

Thanks. I no longer use Terminal, but a drag&drop Applescript I wrote. See http://www.mobileread.com/forums/showthread.php?t=55681

pdurrant
08-18-2010, 02:12 AM
"ePubChecker" is a free easy-to-use program that runs your EPUB file through "epubcheck". Just drag and drop your book file, and click "Check".

Faster than uploading to a web site and more private as you keep your book on your own computer. Runs on Mac OS X 10.4, 10.5, and 10.6.

See the screenshot:
http://www.rainwater-soft.com/epubchecker/

This app is built by my company, but uses the "epubcheck" v1.0.5 checking engine from Google/Adobe as required by Apple when submitting an iBook.

--Basil Bourque

Any advantages over my free Applescript?

Adjust
08-18-2010, 02:44 AM
Any advantages over my free Applescript?

The major problem I have with it is that the error window is way to narrow.

If you can widen the error window so that each error fits on one line, then I will go back to using it.

pdurrant
08-18-2010, 04:55 AM
The major problem I have with it is that the error window is way to narrow.

If you can widen the error window so that each error fits on one line, then I will go back to using it.

Feedback! Thank you!

I'm not sure if I can widen the error window, but I could get it to save the error messages in a text file next to the original folder if there are any warnings or errors.

I'll take a look and see what can be done. It hasn't bothered me because I'm used to the kinds of errors I generate when editing ePubs, but I can see that it's a problem for someone starting out, which is just the kind of person the script is supposed to be helping.

Adjust
08-18-2010, 05:25 AM
Feedback! Thank you!

I'm not sure if I can widen the error window, but I could get it to save the error messages in a text file next to the original folder if there are any warnings or errors.

I'll take a look and see what can be done. It hasn't bothered me because I'm used to the kinds of errors I generate when editing ePubs, but I can see that it's a problem for someone starting out, which is just the kind of person the script is supposed to be helping.

No problems, it was just annoying to have to open yet other program (text edit) to read what the messages were.

I was using yours and just leaving it there as a checklist i.e fix the first few then run it again, rinse and repeat... but because the window was so narrow, I ended up using the threepress upload.

Almiel
08-18-2010, 11:53 AM
Thanks. I no longer use Terminal, but a drag&drop Applescript I wrote. See http://www.mobileread.com/forums/showthread.php?t=55681

Boy, do I wish I'd found this yesterday when I was trying to zip up my files! On the otherhand, the fiddling helps me learn new things. I downloaded it and used it with success. :thanks:

nashville867
08-19-2010, 06:24 PM
Thanks, pdurrant. Works perfectly. Results jibe with threepress's. Very much appreciated.

Adjust
09-07-2010, 12:26 AM
Feedback! Thank you!

I'll take a look and see what can be done.

Have you had a chance to change this yet, I just downloaded it then and checked. It's still the same... I guess all you need (like it's an easy thing :p ) is to have the results message window adjustable...

pdurrant
09-07-2010, 04:23 AM
Have you had a chance to change this yet, I just downloaded it then and checked. It's still the same... I guess all you need (like it's an easy thing :p ) is to have the results message window adjustable...

Unfortunately, I'd need to change from a simple AppleScript to something done with AppleScript Studio, which I don't have time to do. I can make the dialog a little wider by making the button bigger, but not resizable. I have added a feature that saves the error report in a text file. (Same folder as the ePub, with the ePub name with '.txt' added.)

The new version of the script will be uploaded in a minute of two.

pdurrant
01-05-2011, 03:07 PM
Now updated to use epubcheck 1.1 (see the first post in this thread).

dethaksone
08-22-2011, 03:09 AM
update with epubcheck1.2 would be great

pdurrant
08-22-2011, 06:00 AM
update with epubcheck1.2 would be great

Done. See the first post.

dethaksone
08-22-2011, 10:49 AM
Done. See the first post.

Thank you so much:thumbsup:

amarie0
10-07-2011, 11:29 AM
Done. See the first post.

I downloaded the 1.2 one from the first post (mod date 8/22/11) but after running it on an epub, the results window says "epubcheck 1.1 reports no errors".

Just a UI thing?

BTW this is great, Paul.

AM

pdurrant
10-07-2011, 11:34 AM
I downloaded the 1.2 one from the first post (mod date 8/22/11) but after running it on an epub, the results window says "epubcheck 1.1 reports no errors".

Just a UI thing?


Yes, just a UI thing - I forgot to update that string in the AppleScript.

Boonercat
11-28-2011, 03:22 PM
This is awesome, thanks for the tool!

amyg
02-15-2012, 02:19 PM
I took the liberty of updating pdurrant's applescript to run the new epubcheck-3.0b4. I don't know how to make anything but the simplest applescript but updating pdurrant's didn't seem too hard - at least I think I did it right. I tried it out on both an epub that validated and one that didn't and it seems to work. Thanks pdurrant for the original script.

82595

amarie0
02-17-2012, 08:27 AM
Thank you Amy!

JSWolf
02-24-2012, 11:40 AM
There is FlightCrew as well for validating ePub. FlightCrew gives error messages that are easier to understand.

http://code.google.com/p/flightcrew/

Novalis
05-07-2012, 09:00 AM
Is there an updated script for 3.05b yet?

Diegnum
10-11-2012, 12:15 PM
I took the liberty to update to ePubCheck 3.0b5

I'm sorry as I had to translate to french and I don't have time to retranslate.

To translate all the messages :

1. Go to a Mac
2. Right click the app --> Show contents
3. Search the file in Contents/Ressources/Scripts/main.scpt
4. Double click and it will open with Apple Script (pretty easy to read if you have some notions of any programming language - And french !!! But Google Tranlate is your "ami")

Hope it helps

pdurrant
10-13-2012, 05:19 PM
Thanks for the reminder, and thanks for uploading your version.

I have updated my epubcheck AppleScript wrapper to use the 3.0b5 javascript (see first post). I've also added a pretty icon, and I'm pretty sure I've included a French translation.

I may have mangled your French. If I have, let me know and I'll fix it.

If anyone fancies translating it into another language, just look at the Localizable.strings file in Contents/Resources/fr.lproj, and replace the french strings with the desired language. Upload the new file, telling me what language it is, and I'll add it in to the main application.

amarie0
11-17-2012, 01:24 PM
Possible to update this for 3.0RC1?

http://code.google.com/p/epubcheck/

AM

pdurrant
11-17-2012, 05:44 PM
Perhaps tomorrow.

Chang
11-29-2012, 05:39 AM
Perhaps tomorrow.

I hope you could update it asap! :)

pdurrant
11-29-2012, 08:04 AM
I hope you could update it asap! :)

Whoops - I forgot to upload it! Now uploaded.

3.0RC1 now available from the first post.

jaume
02-02-2013, 11:36 AM
Finally ePubcheck 3.0 was released, if I can Help to update the script tell me. There is relevant differences with the RC1...

pdurrant
02-02-2013, 11:45 AM
Now updated to the epubcheck 3.0 release.