mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Amazon metadata download: Update plugin to handle changes to Amazon site that could cause some covers to not be downloaded. Also fix finding metadata for books with + in their titles.
This commit is contained in:
parent
452886aedd
commit
58e933f394
@ -452,7 +452,7 @@ class Worker(Thread): # Get details {{{
|
|||||||
|
|
||||||
|
|
||||||
def parse_cover(self, root):
|
def parse_cover(self, root):
|
||||||
imgs = root.xpath('//img[(@id="prodImage" or @id="original-main-image") and @src]')
|
imgs = root.xpath('//img[(@id="prodImage" or @id="original-main-image" or @id="main-image") and @src]')
|
||||||
if imgs:
|
if imgs:
|
||||||
src = imgs[0].get('src')
|
src = imgs[0].get('src')
|
||||||
if '/no-image-avail' not in src:
|
if '/no-image-avail' not in src:
|
||||||
@ -895,6 +895,13 @@ if __name__ == '__main__': # tests {{{
|
|||||||
isbn_test, title_test, authors_test, comments_test, series_test)
|
isbn_test, title_test, authors_test, comments_test, series_test)
|
||||||
com_tests = [ # {{{
|
com_tests = [ # {{{
|
||||||
|
|
||||||
|
( # + in title and uses id="main-image" for cover
|
||||||
|
{'title':'C++ Concurrency in Action'},
|
||||||
|
[title_test('C++ Concurrency in Action: Practical Multithreading',
|
||||||
|
exact=True),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
( # Series
|
( # Series
|
||||||
{'identifiers':{'amazon':'0756407117'}},
|
{'identifiers':{'amazon':'0756407117'}},
|
||||||
[title_test(
|
[title_test(
|
||||||
|
@ -373,7 +373,7 @@ class Source(Plugin):
|
|||||||
# Remove single quotes not followed by 's'
|
# Remove single quotes not followed by 's'
|
||||||
(r"'(?!s)", ''),
|
(r"'(?!s)", ''),
|
||||||
# Replace other special chars with a space
|
# Replace other special chars with a space
|
||||||
(r'''[:,;+!@$%^&*(){}.`~"\s\[\]/]''', ' '),
|
(r'''[:,;!@$%^&*(){}.`~"\s\[\]/]''', ' '),
|
||||||
]]
|
]]
|
||||||
|
|
||||||
for pat, repl in title_patterns:
|
for pat, repl in title_patterns:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user