mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-25 16:01:29 +02:00
Removed superfluous lopen builtin
This commit is contained in:
@@ -48,7 +48,7 @@ def _metadata_from_formats(formats, force_read_metadata=False, pattern=None):
|
||||
return mi2
|
||||
|
||||
for path, ext in zip(formats, extensions):
|
||||
with lopen(path, 'rb') as stream:
|
||||
with open(path, 'rb') as stream:
|
||||
try:
|
||||
newmi = get_metadata(stream, stream_type=ext,
|
||||
use_libprs_metadata=True,
|
||||
@@ -223,19 +223,19 @@ def opf_metadata(opfpath):
|
||||
|
||||
def forked_read_metadata(path, tdir):
|
||||
from ebook_converter.ebooks.metadata.opf2 import metadata_to_opf
|
||||
with lopen(path, 'rb') as f:
|
||||
with open(path, 'rb') as f:
|
||||
fmt = os.path.splitext(path)[1][1:].lower()
|
||||
f.seek(0, 2)
|
||||
sz = f.tell()
|
||||
with lopen(os.path.join(tdir, 'size.txt'), 'wb') as s:
|
||||
with open(os.path.join(tdir, 'size.txt'), 'wb') as s:
|
||||
s.write(str(sz).encode('ascii'))
|
||||
f.seek(0)
|
||||
mi = get_metadata(f, fmt)
|
||||
if mi.cover_data and mi.cover_data[1]:
|
||||
with lopen(os.path.join(tdir, 'cover.jpg'), 'wb') as f:
|
||||
with open(os.path.join(tdir, 'cover.jpg'), 'wb') as f:
|
||||
f.write(mi.cover_data[1])
|
||||
mi.cover_data = (None, None)
|
||||
mi.cover = 'cover.jpg'
|
||||
opf = metadata_to_opf(mi, default_lang='und')
|
||||
with lopen(os.path.join(tdir, 'metadata.opf'), 'wb') as f:
|
||||
with open(os.path.join(tdir, 'metadata.opf'), 'wb') as f:
|
||||
f.write(opf)
|
||||
|
||||
Reference in New Issue
Block a user