View Single Post
Old 08-11-2011, 05:59 PM   #5
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
You cannot create a new output class for PDB. You must work within the current class. Calibre is file type based. There is no way to associate multiple output classes with a single format.

calibre.ebooks.pdb.output.PDBOutput.convert

This takes the PDB identity and checks if there is a writer associated with it. The writer used for output is taken from calibre.ebooks.pdb.FORMAT_WRITERS. You would need to add a key and associated class reference to this dictionary to enable writing a specific PDB type. Also if you are adding a new identity be sure to add it to calibre.ebooks.pdb.IDENTITY_TO_NAME if it is not already in that list.

calibre.ebooks.pdb.output.PDBInput uses the same design for adding PDB readers.

Add a new module to the PDB module. You will need to put your writer class in a file named writer.py. The writer must be a subclass of calibre.ebooks.pdb.formatreader.FormatReader. Your subclass must implement __init__ and extract_content. Look at the palmdoc module for a simple example.
user_none is offline   Reply With Quote