You can probably do what you want with metadata search/replace.
If not, then you can:
- write python scripts that are run by calibre (calibre-debug -e script.py).
- write user interface plugins
- write metadata plugins.
See
http://manual.calibre-ebook.com/creating_plugins.html and
http://manual.calibre-ebook.com/develop.html for information on writing python code that integrates with calibre.
@theducks: I agree that this is a borderline development thread. Lets see where it goes.