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:
Kovid Goyal 2013-03-07 15:06:43 +05:30
parent 452886aedd
commit 58e933f394
2 changed files with 9 additions and 2 deletions

View File

@ -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(

View File

@ -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: