View Single Post
Old 08-21-2012, 08:10 AM   #1
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 597
Karma: 1281565
Join Date: Dec 2011
Location: Padova, Italy
Device: Kindle3, Odyssey, eDGe, A60, PRS-T1, iPad3, KoboGlo
[GUI Plugin] Ex Libris

This plugin allows you to insert an ex libris into your eBooks in EPUB format.

The source code is available in this GitHub repo.

In particular, this is the Calibre plugin version of the CLI tool described in this discussion.

You can select a single ebook or your entire Calibre library, and have the same ex libris applied to all of them! You can both replace the existing eBooks or create a copy.

You must supply an XHTML file containing the ex libris to be inserted, and --- optionally --- any other resource needed (images, CSS files, fonts, etc.).

If you select a single EPUB book, the main window will show you its spine and TOC, to help you specify the insertion points of the ex libris page.

If you select multiple EPUB books, you can only specify "1" or "first" or "last" as insertion points, both for the spine and for the TOC. You can overrule this limitation (at your own risk!) unchecking the respective checkbox in the configuration window.

The current version can replace placeholders in the XHTML page (written as [%key%]) using the eBook metadata (e.g., [%title%]), Calibre metadata (e.g., [%calibre-title%]) or user-provided strings ([%yourMessageHere%]). The set of supported metadata tags can be found on the configuration window. In the latter case, the user can define her own keys.

Main Features as in v. 1.0.19
  • Single EPUB or Multiple EPUBs selection
  • Spine and TOC are displayed when a single EPUB is selected
  • Replace existing EPUB file or create a copy
  • Include external resources (images, CSS, fonts) beyond the ex libris XHTML page
  • Replace string placeholders in the XHTML page (in the form: [%key%]) with book metadata, Calibre metadata, or user-supplied values that can be set through the configuration window of the plugin
  • Ex libris removal function
  • Help dialog
  • Examples of XHTML ex libris pages included in the ZIP file

Special Notes
  • Your eBook input file must be "EPUB 2.0.1"-compliant, and your ex libris input file must be "XHTML 1.1 strict"-compliant, otherwise exlibris is not guaranteed to work properly and it might produce an invalid EPUB file.
  • Currently exlibris includes the additional files (images, CSS, fonts, etc.) using their extension to set the proper media-type field. Please name your file consistently. For example, do not name a JPEG image 'image.svg' but use 'image.jpg' or 'image.jpeg'.
  • This Calibre plugin was developed under Calibre 0.8.51, but it might work on earlier versions.

Installation Steps
  • Download the attached zip file and install the plugin/restart calibre/add to context menu or toolbar as described in the Introduction to plugins thread.
  • Select at least one EPUB file
  • Open the plugin window (you can use the keyboard shortcut CTRL+SHIFT+X)
  • Click on 'Configure'
  • Select your exlibris XHTML page and, optionally, other external resources and/or modify the default configuration options
  • Click on 'OK'
  • Congratulations, now you can apply your nice ex libris to all the EPUB eBooks you want!

Paypal Donations:
If you like this project, I ask you to consider supporting the eBook Club Italia (http://ebci.it/), a non-profit association that promotes reading, especially using digital devices. You can help through a donation (there is a PayPal button on the right column of the home page) or by becoming a member.

Version History
Spoiler:

Version 1.0.19 - 02 Sep 2014
Alignment with the plugin repo on GitHub: https://github.com/pettarin/exlibris
Version 1.0.18 - 30 Aug 2014
Courtesy of @davidfor of MobileRead, this plugin now works with Calibre 2
Version 1.0.17 - 25 Aug 2013
Fixed a bug preventing the expected operation of the plugin on eBooks already modified by Calibre, which was introduced in zipfile by Python 2.7.4: importing calibre.utils.zipfile instead.
Version 1.0.16 - 14 Nov 2012
Added support for series-index Calibre metadatum (use [%calibre-series-index%] placeholder).
Version 1.0.15 - 11 Nov 2012
Added support for replacing string placeholders in the XHTML ex libris page with Calibre metadata. Added HELP dialog. Added ex libris examples in the ZIP file.
Version 1.0.14 - 21 Oct 2012
Added ex libris removal function. Attempting at adding an ex libris to an EPUB already containing one will result in the latter being overwritten by the new one.
Version 1.0.13 - 02 Sep 2012
Fixed a bug that prevented the correct operation under Windows, by forcing the encoding to UTF8 while reading the original EPUB. Also improved the parsing routines.
Version 1.0.12 Not released
Version 1.0.11 - 26 Aug 2012
Fixed a critical bug involving the creation of a temporary directory to unpack the EPUB file. This bug prevented the correct operation of the plugin when not launched from a console.
Version 1.0.10 - 25 Aug 2012
Fixed two bugs, one in the main exlibris library, the other one in the exception handling.
Version 1.0.9 - 21 Aug 2012
Initial release.
Attached Files
File Type: zip exlibris_plugin_1_0_19.zip (33.6 KB, 5499 views)

Last edited by AlPe; 09-02-2014 at 03:56 PM.
AlPe is offline   Reply With Quote