From 68b08f4a6a5d16b92f7672e4ad0d65ef9d356be5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 3 Feb 2022 12:15:42 +0530 Subject: [PATCH] Metadata download: Fix published date and series information not being fetched for some books from amazon.de. Fixes #1958979 [Amazon metadata download gets not all fields in some cases](https://bugs.launchpad.net/calibre/+bug/1958979) --- src/calibre/ebooks/metadata/sources/amazon.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index 900eeb8f1d..a4a2690b12 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -281,7 +281,7 @@ class Worker(Thread): # Get details {{{ descendant::*[starts-with(text(), "Publication Date:") or \ starts-with(text(), "Audible.com Release Date:")] ''' - self.publisher_names = {'Publisher', 'Uitgever', 'Verlag', 'Utgivare', + self.publisher_names = {'Publisher', 'Uitgever', 'Verlag', 'Utgivare', 'Herausgeber', 'Editore', 'Editeur', 'Editor', 'Editora', '出版社'} self.language_xpath = ''' @@ -733,7 +733,7 @@ class Worker(Thread): # Get details {{{ a = series[0].xpath('descendant::a') if a: raw = self.tostring(a[0], encoding='unicode', method='text', with_tail=False) - m = re.search(r'(?:Book|Libro)\s+(?P[0-9.]+)\s+(?:of|de)\s+([0-9.]+)\s*:\s*(?P.+)', raw.strip()) + m = re.search(r'(?:Book|Libro|Buch)\s+(?P[0-9.]+)\s+(?:of|de|von)\s+([0-9.]+)\s*:\s*(?P.+)', raw.strip()) if m is not None: ans = (m.group('series').strip(), float(m.group('index'))) @@ -968,7 +968,7 @@ class Worker(Thread): # Get details {{{ class Amazon(Source): name = 'Amazon.com' - version = (1, 2, 22) + version = (1, 2, 23) minimum_calibre_version = (2, 82, 0) description = _('Downloads metadata and covers from Amazon') @@ -1656,6 +1656,15 @@ def manual_tests(domain, **kw): # {{{ # }}} all_tests['de'] = [ # {{{ + # series + ( + {'identifiers': {'isbn': '3499275120'}}, + [title_test('Vespasian: Das Schwert des Tribuns: Historischer Roman', + exact=False), authors_test(['Robert Fabbri']), series_test('Die Vespasian-Reihe', 1) + ] + + ), + ( # umlaut in title/authors {'title': 'Flüsternde Wälder', 'authors': ['Nicola Förg']}, @@ -1664,7 +1673,6 @@ def manual_tests(domain, **kw): # {{{ ] ), - ( {'identifiers': {'isbn': '9783453314979'}}, [title_test('Die letzten Wächter: Roman',