From 44276ef20ba694f5acdf50401c4847c93790b969 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 11 Aug 2014 19:19:36 +0530 Subject: [PATCH] Convenience function to convert epub to azw3 directly without invoking the conversion pipeline at all --- src/calibre/ebooks/oeb/polish/container.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index 030ec78a10..f17740424f 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -1147,6 +1147,10 @@ def opf_to_azw3(opf, outpath, container): set_cover(oeb) outp.convert(oeb, outpath, inp, plumber.opts, container.log) +def epub_to_azw3(epub, outpath=None): + container = get_container(epub, tweak_mode=True) + outpath = outpath or (epub.rpartition('.')[0] + '.azw3') + opf_to_azw3(container.name_to_abspath(container.opf_name), outpath, container) class AZW3Container(Container):