mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix ISBN-13 searches not matching when using search engines
This commit is contained in:
parent
eef03c1f3e
commit
02002b062b
@ -1026,6 +1026,9 @@ class Amazon(Source):
|
|||||||
terms.append(asin)
|
terms.append(asin)
|
||||||
elif isbn is not None:
|
elif isbn is not None:
|
||||||
q['field-isbn'] = isbn
|
q['field-isbn'] = isbn
|
||||||
|
if len(isbn) == 13:
|
||||||
|
terms.extend('({} OR {}-{})'.format(isbn, isbn[:3], isbn[3:]).split())
|
||||||
|
else:
|
||||||
terms.append(isbn)
|
terms.append(isbn)
|
||||||
else:
|
else:
|
||||||
# Only return book results
|
# Only return book results
|
||||||
@ -1448,7 +1451,7 @@ if __name__ == '__main__': # tests {{{
|
|||||||
(
|
(
|
||||||
{'identifiers': {'isbn': '9783453314979'}},
|
{'identifiers': {'isbn': '9783453314979'}},
|
||||||
[title_test('Die letzten Wächter: Roman',
|
[title_test('Die letzten Wächter: Roman',
|
||||||
exact=False), authors_test(['Sergej Lukianenko', 'Christiane Pöhlmann'])
|
exact=False), authors_test(['Sergej Lukianenko'])
|
||||||
]
|
]
|
||||||
|
|
||||||
),
|
),
|
||||||
@ -1486,7 +1489,7 @@ if __name__ == '__main__': # tests {{{
|
|||||||
(
|
(
|
||||||
{'identifiers': {'isbn': '8483460831'}},
|
{'identifiers': {'isbn': '8483460831'}},
|
||||||
[title_test('Tiempos Interesantes',
|
[title_test('Tiempos Interesantes',
|
||||||
exact=True), authors_test(['Terry Pratchett'])
|
exact=False), authors_test(['Terry Pratchett'])
|
||||||
]
|
]
|
||||||
|
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user