1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-02 02:13:38 +02:00

Removed facade on os.walk.

This commit is contained in:
2020-10-13 20:32:05 +02:00
parent b44926a6eb
commit 22fed6f4d3
9 changed files with 53 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
import os
from ebook_converter import _ent_pat, walk, xml_entity_to_unicode
from ebook_converter import _ent_pat, xml_entity_to_unicode
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
@@ -157,10 +157,12 @@ class TXTInput(InputFormatPlugin):
zf = ZipFile(stream)
zf.extractall('.')
for x in walk('.'):
if os.path.splitext(x)[1].lower() in ('.txt', '.text'):
with open(x, 'rb') as tf:
txt += tf.read() + b'\n\n'
for root, _, fnames in os.walk('.'):
for x in fnames:
x = os.path.join(root, x)
if os.path.splitext(x)[1].lower() in ('.txt', '.text'):
with open(x, 'rb') as tf:
txt += tf.read() + b'\n\n'
else:
if getattr(stream, 'name', None):
base_dir = os.path.dirname(stream.name)