mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Fix conversion of .oeb.zip to LRF
This commit is contained in:
parent
faa405e008
commit
65977f0133
@ -28,12 +28,18 @@ def largest_file(files):
|
|||||||
def find_htmlfile(dir):
|
def find_htmlfile(dir):
|
||||||
ext_pat = re.compile(r'\.(x){0,1}htm(l){0,1}', re.IGNORECASE)
|
ext_pat = re.compile(r'\.(x){0,1}htm(l){0,1}', re.IGNORECASE)
|
||||||
toc_pat = re.compile(r'toc', re.IGNORECASE)
|
toc_pat = re.compile(r'toc', re.IGNORECASE)
|
||||||
toc_files, files = [], []
|
index_pat = re.compile(r'index', re.IGNORECASE)
|
||||||
for f in map(lambda x:os.path.join(dir, x), os.listdir(dir)):
|
toc_files, index_files, files = [], [], []
|
||||||
ext = os.path.splitext(f)[1]
|
|
||||||
if ext and ext_pat.match(ext):
|
for root, dirs, _files in os.walk(dir):
|
||||||
toc_files.append(f) if toc_pat.search(f) else files.append(f)
|
for f in _files:
|
||||||
a = toc_files if toc_files else files
|
f = os.path.abspath(os.path.join(root, f))
|
||||||
|
ext = os.path.splitext(f)[1]
|
||||||
|
if ext and ext_pat.match(ext):
|
||||||
|
toc_files.append(f) if toc_pat.search(f) else \
|
||||||
|
index_files.append(f) if index_pat.search(f) else \
|
||||||
|
files.append(f)
|
||||||
|
a = toc_files if toc_files else index_files if index_files else files
|
||||||
if a:
|
if a:
|
||||||
return largest_file(a)
|
return largest_file(a)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user