Generalize nophoto url, update setting openlibrary URL
This commit is contained in:
@@ -46,11 +46,11 @@ def validate_bookcover(book_details):
|
|||||||
This API checks for book cover, and returns with a valid
|
This API checks for book cover, and returns with a valid
|
||||||
bookcover if nophoto found on goodreads, using openlibrary
|
bookcover if nophoto found on goodreads, using openlibrary
|
||||||
"""
|
"""
|
||||||
no_photo_url='https://s.gr-assets.com/assets/nophoto/book/111x148-bcc042a9c91a29c1d680899eff700a03.png'
|
no_photo_url='https://s.gr-assets.com/assets/nophoto/book/'
|
||||||
open_library_url='http://covers.openlibrary.org/b/isbn/book_isbn-M.jpg'
|
open_library_url='http://covers.openlibrary.org/b/isbn/{isbn}-M.jpg'
|
||||||
|
|
||||||
if (book_details['image_url'] == no_photo_url):
|
if (book_details['image_url'].__contains__(no_photo_url)):
|
||||||
book_details['image_url'] = open_library_url.replace('book_isbn', book_details['isbn'])
|
book_details['image_url'] = open_library_url.format(isbn=book_details['isbn'])
|
||||||
return book_details
|
return book_details
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user