View Full Version : Developing a plugin on osx 10.5

08-27-2009, 02:06 PM
Hi, this is a beginner question regarding python development on osx using application bundles.

I would like to create a calibre plugin that automatically locates the ISBN from each book in my library and pulls the book metadata from the internet: title, author, publisher, date.

I have looked at the plug-in documentation, and I have a basic understanding of python. However, I'm unsure how to reference the calibre python module from within the application bundle.

Does anyone have an example of how to do this?

08-27-2009, 02:55 PM
You wont be able to create a plugin to automatically fetch the metadata. But you can just create a new metadata reader plugin for your files that extracts the ISBN. That way you can just click a button and calibre will download all metadata based on the extracted plugin.

As for your question: Look in the calibre sources (in the builtins module) to see how metadata reader plugins are created. Create yours in exactly the same way and add it to calibre with a high priority so it overrides the built-in one.

08-28-2009, 03:54 PM
If I understand correctly, you want to update the Meta-Data for all of the books that are already in your library, correct?

Looks like you'll want to use Calibre's command-line tools and create a standalone script.

Let's see, to get a list of your books (you'll need the database IDs for each one):
calibredb list

Then you need to get the current metadata so that you can get the ISBN number:
calibredb show_metadata [options] id

Then you'll want to use that ISBN to search for Metadata:
fetch-ebook-metadata --isbn ########

And then you take that new data and apply it to each eBook in the database by id:
calibredb set_metadata id /path/to/metadata.opf

Anyhow, I leave the details to you on how you want to script it. You could do it in Applescript if you want. Let us know how far you get!

- Jim