mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-03-13 04:55:49 +01:00
Cleaned up __init__.py for main module
This commit is contained in:
@@ -5,8 +5,8 @@ import shutil, textwrap, codecs, os
|
||||
|
||||
from ebook_converter import constants as const
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.ptempfile import PersistentTemporaryDirectory
|
||||
from ebook_converter.utils import directory
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
@@ -98,7 +98,7 @@ class ComicInput(InputFormatPlugin):
|
||||
tdir = PersistentTemporaryDirectory('_comic_collection')
|
||||
zipextract(stream, tdir)
|
||||
comics = []
|
||||
with CurrentDir(tdir):
|
||||
with directory.CurrentDir(tdir):
|
||||
if not os.path.exists('comics.txt'):
|
||||
raise ValueError((
|
||||
'%s is not a valid comic collection'
|
||||
|
||||
@@ -8,16 +8,11 @@ from ebook_converter.ebooks.oeb import base
|
||||
from ebook_converter.ebooks.oeb import parse_utils
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin
|
||||
from ebook_converter.customize.conversion import OptionRecommendation
|
||||
|
||||
from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.polyglot.builtins import as_bytes
|
||||
from ebook_converter.utils import directory
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
block_level_tags = (
|
||||
'address',
|
||||
'body',
|
||||
@@ -320,7 +315,7 @@ class EPUBOutput(OutputFormatPlugin):
|
||||
raise ValueError('UUID identifier %r is invalid'% _uuid)
|
||||
key = bytearray(from_hex_bytes((key + key)[:32]))
|
||||
paths = []
|
||||
with CurrentDir(tdir):
|
||||
with directory.CurrentDir(tdir):
|
||||
paths = [os.path.join(*x.split('/')) for x in uris]
|
||||
uris = dict(zip(uris, paths))
|
||||
fonts = []
|
||||
|
||||
@@ -5,16 +5,12 @@ import shutil
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter.ebooks.oeb.base import element
|
||||
from ebook_converter.polyglot.urllib import unquote
|
||||
from ebook_converter.ptempfile import PersistentTemporaryDirectory
|
||||
from ebook_converter.utils.cleantext import clean_xml_chars
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Fabian Grassl <fg@jusmeum.de>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
from ebook_converter.utils import directory
|
||||
|
||||
|
||||
def relpath(*args):
|
||||
@@ -52,7 +48,7 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
Generate table of contents
|
||||
'''
|
||||
|
||||
with CurrentDir(output_dir):
|
||||
with directory.CurrentDir(output_dir):
|
||||
def build_node(current_node, parent=None):
|
||||
if parent is None:
|
||||
parent = etree.Element('ul')
|
||||
@@ -158,7 +154,7 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
t = t.encode('utf-8')
|
||||
f.write(t)
|
||||
|
||||
with CurrentDir(output_dir):
|
||||
with directory.CurrentDir(output_dir):
|
||||
for item in oeb_book.manifest:
|
||||
path = os.path.abspath(unquote(item.href))
|
||||
dir = os.path.dirname(path)
|
||||
|
||||
@@ -5,15 +5,10 @@ from lxml import etree
|
||||
|
||||
from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
OptionRecommendation)
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.polyglot.urllib import unquote
|
||||
from ebook_converter.ebooks.oeb.base import OPF_MIME, NCX_MIME, PAGE_MAP_MIME, OEB_STYLES
|
||||
from ebook_converter.ebooks.oeb.normalize_css import condense_sheet
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
from ebook_converter.utils import directory
|
||||
|
||||
|
||||
class OEBOutput(OutputFormatPlugin):
|
||||
@@ -30,7 +25,7 @@ class OEBOutput(OutputFormatPlugin):
|
||||
self.log, self.opts = log, opts
|
||||
if not os.path.exists(output_path):
|
||||
os.makedirs(output_path)
|
||||
with CurrentDir(output_path):
|
||||
with directory.CurrentDir(output_path):
|
||||
results = oeb_book.to_opf2(page_map=True)
|
||||
for key in (OPF_MIME, NCX_MIME, PAGE_MAP_MIME):
|
||||
href, root = results.pop(key, [None, None])
|
||||
|
||||
Reference in New Issue
Block a user