View Single Post
Old 08-05-2013, 12:48 PM   #7
jgoguen
Generally Awesome Person
jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.
 
Posts: 1,061
Karma: 2178845
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
It doesn't seem to matter if I have a configuration widget or not. I have been able to get the conversion to succeed with this code:
Code:
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai

__license__ = 'GPL v3'
__copyright__ = '2013, Joel Goguen <jgoguen@jgoguen.ca>'
__docformat__ = 'markdown en'

from calibre.customize.conversion import OptionRecommendation
from calibre.ebooks.conversion.plugins.epub_output import EPUBOutput

class KEPubOutput(EPUBOutput):
    name = 'KePub Output'
    author = 'Joel Goguen'
    file_type = 'kepub'

    def __init__(self, *args):
        self.options.add(
            OptionRecommendation(name='opt_kepub_enable_extended_features', recommended_value=True, level=OptionRecommendation.HIGH,
            help='Choose whether to enable extra customisations')
        )
        self.options.add(
            OptionRecommendation(name='opt_kepub_delete_unmanifested', recommended_value=False,
                                 level=OptionRecommendation.LOW,
                                 help='Select this to silently delete files that are not in the '
                                 'manifest if they are encountered during processing. If this '
                                 'option is not selected, files not in the manifest will be '
                                 'silently added to the manifest and processed as if they always '
                                 'were in the manifest.')
        )
        self.options.add(
            OptionRecommendation(name='opt_kepub_hyphenate', recommended_value=True,
                                 level=OptionRecommendation.MED,
                                 help='Select this to add a CSS file which enables hyphenation. '
                                 'The language used will be the language defined for the book in '
                                 'calibre. Please see the README file for directions on updating '
                                 'hyphenation dictionaries.')
        )
        self.options.add(
            OptionRecommendation(name='opt_kepub_replace_lang', recommended_value=True,
                                 level=OptionRecommendation.HIGH,
                                 help='Select this to replace the defined language in each '
                                 'content file inside the ePub.')
        )
        self.options.add(
            OptionRecommendation(name='opt_kepub_clean_markup', recommended_value=True,
                                 level=OptionRecommendation.MED,
                                 help='Select this to clean up the internal ePub markup.')
        )

        EPUBOutput.__init__(self, *args)
If I add either of the following methods to the above class, I get the same exception thrown saying that there's no format plugin for 'kepub'.
Code:
    def gui_configuration_widget(self, parent, get_option_by_name, get_option_help, db, book_id=None):
        return None
Code:
    def convert(self, oeb, output_path, input_plugin, opts, log):
        super(KEPubOutput, self).convert(oeb, output_path, input_plugin, opts, log)
jgoguen is offline   Reply With Quote