From 425152cda210617f150a4c7e05bdbdbfd5d4efc3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 8 Dec 2021 20:53:14 +0530 Subject: [PATCH] Fix langauge not being detected on amazon.de --- src/calibre/ebooks/metadata/sources/amazon.py | 6 +++--- src/calibre/ebooks/metadata/sources/test.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index 52a9b44bbc..900eeb8f1d 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -885,7 +885,7 @@ class Worker(Thread): # Get details {{{ def parse_detail_cells(self, mi, c1, c2): name = self.totext(c1, only_printable=True).strip().strip(':').strip() - val = self.totext(c2) + val = self.totext(c2).strip() if not val: return if name in self.language_names: @@ -968,7 +968,7 @@ class Worker(Thread): # Get details {{{ class Amazon(Source): name = 'Amazon.com' - version = (1, 2, 21) + version = (1, 2, 22) minimum_calibre_version = (2, 82, 0) description = _('Downloads metadata and covers from Amazon') @@ -1660,7 +1660,7 @@ def manual_tests(domain, **kw): # {{{ {'title': 'Flüsternde Wälder', 'authors': ['Nicola Förg']}, [title_test('Flüsternde Wälder'), - authors_test(['Nicola Förg']) + authors_test(['Nicola Förg'], subset=True) ] ), diff --git a/src/calibre/ebooks/metadata/sources/test.py b/src/calibre/ebooks/metadata/sources/test.py index cc0870fa2e..427ee4e21e 100644 --- a/src/calibre/ebooks/metadata/sources/test.py +++ b/src/calibre/ebooks/metadata/sources/test.py @@ -45,7 +45,7 @@ def title_test(title, exact=False): return test -def authors_test(authors): +def authors_test(authors, subset=False): authors = {x.lower() for x in authors} def test(mi): @@ -62,6 +62,8 @@ def authors_test(authors): au = {revert_to_fn_ln(x) for x in au} + if subset and authors.issubset(au): + return True if au == authors: return True prints('Author test failed. Expected: \'%s\' found \'%s\''%(authors, au))