mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Also fallback to version 0 regexps for reading metadata from filenames
Fixes #1898739 [Viewer fail opening books](https://bugs.launchpad.net/calibre/+bug/1898739)
This commit is contained in:
parent
45f9e9318c
commit
019f1c8fb2
@ -133,7 +133,10 @@ def metadata_from_filename(name, pat=None, fallback_pat=None):
|
|||||||
name = name.rpartition('.')[0]
|
name = name.rpartition('.')[0]
|
||||||
mi = MetaInformation(None, None)
|
mi = MetaInformation(None, None)
|
||||||
if pat is None:
|
if pat is None:
|
||||||
pat = regex.compile(prefs.get('filename_pattern'), flags=regex.UNICODE | regex.VERSION1 | regex.FULLCASE)
|
try:
|
||||||
|
pat = regex.compile(prefs.get('filename_pattern'), flags=regex.UNICODE | regex.VERSION1 | regex.FULLCASE)
|
||||||
|
except Exception:
|
||||||
|
pat = regex.compile(prefs.get('filename_pattern'), flags=regex.UNICODE | regex.VERSION0 | regex.FULLCASE)
|
||||||
name = name.replace('_', ' ')
|
name = name.replace('_', ' ')
|
||||||
match = pat.search(name)
|
match = pat.search(name)
|
||||||
if match is None and fallback_pat is not None:
|
if match is None and fallback_pat is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user