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:
Kovid Goyal 2020-10-06 20:23:55 +05:30
parent 45f9e9318c
commit 019f1c8fb2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -133,7 +133,10 @@ def metadata_from_filename(name, pat=None, fallback_pat=None):
name = name.rpartition('.')[0]
mi = MetaInformation(None, None)
if pat is None:
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('_', ' ')
match = pat.search(name)
if match is None and fallback_pat is not None: