mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #446
This commit is contained in:
parent
46fee39026
commit
04ca5c26b4
@ -1801,9 +1801,14 @@ def try_opf(path, options, logger):
|
|||||||
if hasattr(options, 'opf'):
|
if hasattr(options, 'opf'):
|
||||||
opf = options.opf
|
opf = options.opf
|
||||||
else:
|
else:
|
||||||
try:
|
files = glob.glob(os.path.join(os.path.dirname(path),'*'))
|
||||||
opf = glob.glob(os.path.join(os.path.dirname(path),'*.opf'))[0]
|
opf = None
|
||||||
except IndexError:
|
for f in files:
|
||||||
|
ext = f.rpartition('.')[-1].lower()
|
||||||
|
if ext == 'opf':
|
||||||
|
opf = f
|
||||||
|
break
|
||||||
|
if opf is None:
|
||||||
return
|
return
|
||||||
dirpath = os.path.dirname(os.path.abspath(opf))
|
dirpath = os.path.dirname(os.path.abspath(opf))
|
||||||
opf = OPFReader(open(opf, 'rb'), dirpath)
|
opf = OPFReader(open(opf, 'rb'), dirpath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user