mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #782742 (Download metadata never finds anything)
This commit is contained in:
parent
5af35ae15f
commit
c6066ce7e3
@ -10,7 +10,6 @@ License: http://www.opensource.org/licenses/mit-license.php
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from calibre.utils.icu import capitalize
|
from calibre.utils.icu import capitalize
|
||||||
from calibre.utils.config import prefs
|
|
||||||
|
|
||||||
__all__ = ['titlecase']
|
__all__ = ['titlecase']
|
||||||
__version__ = '0.5'
|
__version__ = '0.5'
|
||||||
@ -31,6 +30,17 @@ ALL_CAPS = re.compile(r'^[A-Z\s%s]+$' % PUNCT)
|
|||||||
UC_INITIALS = re.compile(r"^(?:[A-Z]{1}\.{1}|[A-Z]{1}\.{1}[A-Z]{1})+$")
|
UC_INITIALS = re.compile(r"^(?:[A-Z]{1}\.{1}|[A-Z]{1}\.{1}[A-Z]{1})+$")
|
||||||
MAC_MC = re.compile(r"^([Mm]a?c)(.+)")
|
MAC_MC = re.compile(r"^([Mm]a?c)(.+)")
|
||||||
|
|
||||||
|
|
||||||
|
_lang = None
|
||||||
|
|
||||||
|
def lang():
|
||||||
|
global _lang
|
||||||
|
if _lang is None:
|
||||||
|
from calibre.utils.localization import get_lang
|
||||||
|
_lang = get_lang().lower()
|
||||||
|
return _lang
|
||||||
|
|
||||||
|
|
||||||
def titlecase(text):
|
def titlecase(text):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -68,7 +78,7 @@ def titlecase(text):
|
|||||||
line.append(icu_lower(word))
|
line.append(icu_lower(word))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if prefs['language'].lower().startswith('en'):
|
if lang().startswith('en'):
|
||||||
match = MAC_MC.match(word)
|
match = MAC_MC.match(word)
|
||||||
if match and not match.group(2)[:3] in ('hin', 'ht'):
|
if match and not match.group(2)[:3] in ('hin', 'ht'):
|
||||||
line.append("%s%s" % (capitalize(match.group(1)),
|
line.append("%s%s" % (capitalize(match.group(1)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user