Fix langauge not being detected on amazon.de

This commit is contained in:
Kovid Goyal 2021-12-08 20:53:14 +05:30
parent 0f56a27b97
commit 425152cda2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 4 deletions

View File

@ -885,7 +885,7 @@ class Worker(Thread): # Get details {{{
def parse_detail_cells(self, mi, c1, c2): def parse_detail_cells(self, mi, c1, c2):
name = self.totext(c1, only_printable=True).strip().strip(':').strip() name = self.totext(c1, only_printable=True).strip().strip(':').strip()
val = self.totext(c2) val = self.totext(c2).strip()
if not val: if not val:
return return
if name in self.language_names: if name in self.language_names:
@ -968,7 +968,7 @@ class Worker(Thread): # Get details {{{
class Amazon(Source): class Amazon(Source):
name = 'Amazon.com' name = 'Amazon.com'
version = (1, 2, 21) version = (1, 2, 22)
minimum_calibre_version = (2, 82, 0) minimum_calibre_version = (2, 82, 0)
description = _('Downloads metadata and covers from Amazon') description = _('Downloads metadata and covers from Amazon')
@ -1660,7 +1660,7 @@ def manual_tests(domain, **kw): # {{{
{'title': 'Flüsternde Wälder', {'title': 'Flüsternde Wälder',
'authors': ['Nicola Förg']}, 'authors': ['Nicola Förg']},
[title_test('Flüsternde Wälder'), [title_test('Flüsternde Wälder'),
authors_test(['Nicola Förg']) authors_test(['Nicola Förg'], subset=True)
] ]
), ),

View File

@ -45,7 +45,7 @@ def title_test(title, exact=False):
return test return test
def authors_test(authors): def authors_test(authors, subset=False):
authors = {x.lower() for x in authors} authors = {x.lower() for x in authors}
def test(mi): def test(mi):
@ -62,6 +62,8 @@ def authors_test(authors):
au = {revert_to_fn_ln(x) for x in au} au = {revert_to_fn_ln(x) for x in au}
if subset and authors.issubset(au):
return True
if au == authors: if au == authors:
return True return True
prints('Author test failed. Expected: \'%s\' found \'%s\''%(authors, au)) prints('Author test failed. Expected: \'%s\' found \'%s\''%(authors, au))