1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-03-15 14:13:40 +01:00

Convert calibre modules to ebook_converter.

Here is the first batch of modules, which are needed for converting
several formats to LRF. Some of the logic has been change, more cleanups
will follow.
This commit is contained in:
2020-04-11 19:33:43 +02:00
parent 69d2e536c5
commit 0f9792df36
252 changed files with 1925 additions and 2344 deletions

View File

@@ -17,10 +17,10 @@ from odf.opendocument import load as odLoad
from odf.draw import Frame as odFrame, Image as odImage
from odf.namespaces import TEXTNS as odTEXTNS
from calibre import CurrentDir, walk
from calibre.ebooks.oeb.base import _css_logger
from calibre.utils.xml_parse import safe_xml_fromstring
from polyglot.builtins import unicode_type, string_or_bytes, filter, getcwd, as_bytes
from ebook_converter import CurrentDir, walk
from ebook_converter.ebooks.oeb.base import _css_logger
from ebook_converter.utils.xml_parse import safe_xml_fromstring
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes, filter, getcwd, as_bytes
class Extract(ODF2XHTML):
@@ -88,7 +88,7 @@ class Extract(ODF2XHTML):
return rule
def epubify_markup(self, root, log):
from calibre.ebooks.oeb.base import XPath, XHTML
from ebook_converter.ebooks.oeb.base import XPath, XHTML
# Fix empty title tags
for t in XPath('//h:title')(root):
if not t.text:
@@ -265,9 +265,9 @@ class Extract(ODF2XHTML):
self._walknode(self.document.topnode)
def __call__(self, stream, odir, log):
from calibre.utils.zipfile import ZipFile
from calibre.ebooks.metadata.odt import get_metadata
from calibre.ebooks.metadata.opf2 import OPFCreator
from ebook_converter.utils.zipfile import ZipFile
from ebook_converter.ebooks.metadata.odt import get_metadata
from ebook_converter.ebooks.metadata.opf2 import OPFCreator
if not os.path.exists(odir):
os.makedirs(odir)