mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
362328dc9d
commit
3aeca93ff3
@ -104,6 +104,17 @@ class Worker(Thread): # Get details {{{
|
|||||||
self.ratings_pat = re.compile(
|
self.ratings_pat = re.compile(
|
||||||
r'([0-9.]+) (out of|von|su|étoiles sur) (\d+)( (stars|Sternen|stelle)){0,1}')
|
r'([0-9.]+) (out of|von|su|étoiles sur) (\d+)( (stars|Sternen|stelle)){0,1}')
|
||||||
|
|
||||||
|
lm = {
|
||||||
|
'en': ('English', 'Englisch'),
|
||||||
|
'fr': ('French', 'Français'),
|
||||||
|
'it': ('Italian', 'Italiano'),
|
||||||
|
'de': ('German', 'Deutsch'),
|
||||||
|
}
|
||||||
|
self.lang_map = {}
|
||||||
|
for code, names in lm.iteritems():
|
||||||
|
for name in names:
|
||||||
|
self.lang_map[name] = code
|
||||||
|
|
||||||
def delocalize_datestr(self, raw):
|
def delocalize_datestr(self, raw):
|
||||||
if not self.months:
|
if not self.months:
|
||||||
return raw
|
return raw
|
||||||
@ -362,14 +373,9 @@ class Worker(Thread): # Get details {{{
|
|||||||
for x in reversed(pd.xpath(self.language_xpath)):
|
for x in reversed(pd.xpath(self.language_xpath)):
|
||||||
if x.tail:
|
if x.tail:
|
||||||
ans = x.tail.strip()
|
ans = x.tail.strip()
|
||||||
if ans in ('English', 'Englisch'):
|
ans = self.lang_map.get(ans, None)
|
||||||
return 'en'
|
if ans:
|
||||||
elif ans in ('German', 'Deutsch'):
|
return ans
|
||||||
return 'de'
|
|
||||||
elif ans in ('Italian', 'Italiano'):
|
|
||||||
return 'it'
|
|
||||||
elif ans in ('French', 'Français',):
|
|
||||||
return 'fr'
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class Amazon(Source):
|
class Amazon(Source):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user