Fix #1971015 [[Bug] Amazon metadata downloader give empty title if title start with "["](https://bugs.launchpad.net/calibre/+bug/1971015)

This commit is contained in:
Kovid Goyal 2022-04-30 13:14:12 +05:30
parent 72371f4f87
commit 3db4c98315
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -522,9 +522,9 @@ class Worker(Thread): # Get details {{{
def parse_title(self, root): def parse_title(self, root):
def sanitize_title(title): def sanitize_title(title):
ans = re.sub(r'[(\[].*[)\]]', '', title).strip() ans = title.strip()
if not ans: if not ans.startswith('['):
ans = title.rpartition('[')[0].strip() ans = re.sub(r'[(\[].*[)\]]', '', title).strip()
return ans return ans
h1 = root.xpath('//h1[@id="title"]') h1 = root.xpath('//h1[@id="title"]')
@ -975,7 +975,7 @@ class Worker(Thread): # Get details {{{
class Amazon(Source): class Amazon(Source):
name = 'Amazon.com' name = 'Amazon.com'
version = (1, 2, 26) version = (1, 2, 27)
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')