mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
45adf46944
commit
305f5a8acb
@ -296,10 +296,15 @@ class Source(Plugin):
|
|||||||
if title:
|
if title:
|
||||||
title_patterns = [(re.compile(pat, re.IGNORECASE), repl) for pat, repl in
|
title_patterns = [(re.compile(pat, re.IGNORECASE), repl) for pat, repl in
|
||||||
[
|
[
|
||||||
|
# Remove things like: (2010) (Omnibus) etc.
|
||||||
(r'(?i)[({\[](\d{4}|omnibus|anthology|hardcover|paperback|mass\s*market|edition|ed\.)[\])}]', ''),
|
(r'(?i)[({\[](\d{4}|omnibus|anthology|hardcover|paperback|mass\s*market|edition|ed\.)[\])}]', ''),
|
||||||
|
# Remove commas used a separators in numbers
|
||||||
(r'(\d+),(\d+)', r'\1\2'),
|
(r'(\d+),(\d+)', r'\1\2'),
|
||||||
|
# Remove hyphens only if they have whitespace before them
|
||||||
(r'(\s-)', ' '),
|
(r'(\s-)', ' '),
|
||||||
|
# Remove single quotes
|
||||||
(r"'", ''),
|
(r"'", ''),
|
||||||
|
# Replace other special chars with a space
|
||||||
(r'''[:,;+!@#$%^&*(){}.`~"\s\[\]/]''', ' ')
|
(r'''[:,;+!@#$%^&*(){}.`~"\s\[\]/]''', ' ')
|
||||||
]]
|
]]
|
||||||
for pat, repl in title_patterns:
|
for pat, repl in title_patterns:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user