For a couple of reasons I found myself running into limitations using the Calibre tools for working with epubs. One issue has been performance and the other is being able to more comprehensively interact with the OPF Package fields specific to epub.
This led me to work on a library and some command-line utilities for working specifically with epub files (and only epub files). My software is compiled into native code and is not only extremely performant but also doesn't carry dependencies to any VM or interpreter.
The programs in epub-tools are:
epubmeta:
a command-line utility for examining and editing epub book metadata. With it you can export, import and edit the raw OPF Package XML document for a given book. Or simply dump the metadata to stdout for viewing in a friendly format.
here's an example of epubmeta output:
Code:
$ epubmeta Kelly_Kessel_Lethem-NinetyPercentOfEverything.epub
package
version: 2.0
unique-identifier: calibre_id
title: Ninety Percent of Everything
creator
role: aut
file-as: Kelly, James Patrick
creator: James Patrick Kelly
creator
role: aut
creator: John Kessel
creator
role: aut
creator: Jonathan Lethem
contributor
role: bkp
file-as: calibre
creator: calibre (0.5.1) [http://calibre.kovidgoyal.net]
date: 2001-03-25T00:00:00
identifier
id: calibre_id
scheme: calibre
identifier: b1026732-69a5-4a05-a8d9-a1701685f6fa
identifier
id: [WARNING: missing required id attribute]
scheme: ISBN
identifier: 1-590620-00-3
subject: Science Fiction/Fantasy
publisher: www.Fictionwise.com
language: en-us
epubname:
a command-line utility for renaming epub ebook files based on their OPF Package metadata. It tries to use author names and title info to construct a sensible name.
Using it looks like this:
Code:
$ epubname poorly-named-book.epub
poorly-named-book.epub -> WattsPeter-Blindsight_2006.epub
$ epubname another-poorly-named-book.epub
another-poorly-named-book.epub -> Kelly_Kessel_Lethem-NinetyPercentOfEverything.epub
epubzip:
a handy utility for zipping up the files that comprise an epub into an .epub zip file. Using the same technology as epubname, it can try to make a meaningful filename for the book.
I ran a time comparison of using epubmeta (from epub-tools) and ebook-meta (from Calibre) side-by-side against a random sample of 50 epub files (mostly purchased from Fictionwise). The results of a simple dump of book metadata using these tools looks like this:
Code:
$ time for F in *.epub ; do ebook-meta $F ; done
real 2m15.550s
user 2m7.352s
sys 0m5.480s
$ time for F in *.epub ; do epubmeta $F ; done
real 0m0.767s
user 0m0.530s
sys 0m0.163s
This software is open-source and is available for UNIX-like operating systems and in Windows binary form, downloadable at its home:
http://ui3.info/d/proj/epub-tools.html
One thing I would be open to is more switches for epubmeta to allow you to script changes to books. At the moment, you can edit or export/import the OPF XML document in the book with it, which has been enough for my needs.
Any feedback would be welcome:
dino@ui3.info