epub-tools is a suite of command-line utilities for creating and manipulating epub book files. Included are: epubmeta, epubname, epubzip. This software uses the epub-metadata library, also available on Hackage.
epubmeta is 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:
$ epubmeta Kelly_Kessel_Lethem-NinetyPercentOfEverything.epub
title: Ninety Percent of Everything
file-as: Kelly, James Patrick
text: James Patrick Kelly
text: John Kessel
text: Jonathan Lethem
text: calibre (0.5.1) [http://calibre.kovidgoyal.net]
id: [WARNING: missing required id attribute]
subject: Science Fiction/Fantasy
epubname is 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:
$ 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 is 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.
The software in epub-tools is written in Haskell. It's known to build under GHC 7.6.2
- 2013-04-14 (v2.2)
- Updated to build against recent changes and bug fixes in epub-metadata 3.0
- All support data files have been brought into the binaries now. This makes these tools more tolerant to being moved to a different location than what they were configured for build with.
- Some documentation additions and changes
- 2013-02-03 (v2.1.1)
- Fixed a stack overflow problem with some epub documents
- 2013-02-01 (v2.1.0)
- Added new subjectMatch command to the DSL, similar to authorMatch. This is being primarily used to detect anthology publications.
- Removed some rules that are now handled by anthology detection, and fixed relevant unit tests
- Clarified DSL documentation for authorMatch a little more
- Modified rules for some magazines to reflect changes to recent editions
- Fixed an error in the DSL documentation
- Fixed a bug in epubzip where no epub file will be created if none already exists
- 2012-10-31 (v2.0.0)
- Major redesign of the formatting rules system. Renaming machinery is now described in a domain-specific language, NOT in statically compiled code. Users are able to extend the functionality with custom naming rules in conf files.
- Added interactive mode to ask about each file rename as they happen, this is like darcs now!
- Added ability to specify target directory for books to be moved to as part of renaming. Includes code to check that target directory exists.
- Removed --overwrite option. Turns out, renameFile has always been smart enough to not overwrite existing.
- Added / character to filters, a big no-no character for file paths on most sane filesystems
- Publication year was looking for publication before original-publication, causing problems in books that have both tags
- Miscellaneous rules changes for various publications
- 2012-01-29 (v1.1.2)
- Changed how this code provides epub zip file contents as a ByteString to the epub-metadata library. Need to read this data strictly to avoid dangling open files.
- Corrected for breakage due to change in title format of Eclipse magazine
- Some work done on the utility script for deploying Windows binaries of these tools
- Added parsing support and test cases for more date formats
- Minor usage info changes
- 2011-11-15 (v1.1.1)
- Changed how publication date is found to more closely follow the OPF spec recommendations
- Changed the switches related to publication date
- Redesigned unit test code and added more tests for new date code
- 2011-11-04 (v1.1.0)
- Huge redesign of how formatting works, dramatically shortening the code needed to handle any given book type. Code is much more monadic now and consolidated into one module.
- Many changes/additions to magazine and compilation book name formatting
- Fixed a group of bugs that occur when a creator has only a single word for their name
- Extensive changes/additions to unit testing for above
- 2011-10-27 (v126.96.36.199)
- Extensive changes to the cabal build of this project to bring it up to Cabal 1.10
- Unit tests now use the test-suite cabal stanza
- 2011-04-23 (v188.8.131.52)
- Download pre-built Windows binary from here
- Build and install with cabal-install:
$ cabal update ; cabal install epub-tools
- Download the cabalized package from Hackage
- Download the cabalized source tarball from here
- Get source with darcs:
$ darcs get http://ui3.info/darcs/epub-tools
- Or browse the source on the web
- epub-tools may be available for Arch Linux from the AUR
last modified 2013-04-14