mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-10-31 15:23:02 +00:00 
			
		
		
		
	Make goodreads compatible for betterreads dependency
This commit is contained in:
		| @@ -20,7 +20,10 @@ from __future__ import division, print_function, unicode_literals | |||||||
| import time | import time | ||||||
| from functools import reduce | from functools import reduce | ||||||
|  |  | ||||||
| from goodreads.client import GoodreadsClient | try: | ||||||
|  |     from goodreads.client import GoodreadsClient | ||||||
|  | except ImportError: | ||||||
|  |     from betterreads.client import GoodreadsClient | ||||||
|  |  | ||||||
| try: import Levenshtein | try: import Levenshtein | ||||||
| except ImportError: Levenshtein = False | except ImportError: Levenshtein = False | ||||||
| @@ -54,7 +57,7 @@ def connect(key=None, secret=None, enabled=True): | |||||||
|  |  | ||||||
| def get_author_info(author_name): | def get_author_info(author_name): | ||||||
|     now = time.time() |     now = time.time() | ||||||
|     author_info = _AUTHORS_CACHE.get(author_name, None) |     author_info = None # _AUTHORS_CACHE.get(author_name, None) | ||||||
|     if author_info: |     if author_info: | ||||||
|         if now < author_info._timestamp + _CACHE_TIMEOUT: |         if now < author_info._timestamp + _CACHE_TIMEOUT: | ||||||
|             return author_info |             return author_info | ||||||
| @@ -95,8 +98,12 @@ def get_other_books(author_info, library_books=None): | |||||||
|     for book in author_info.books: |     for book in author_info.books: | ||||||
|         if book.isbn in identifiers: |         if book.isbn in identifiers: | ||||||
|             continue |             continue | ||||||
|         if book.gid["#text"] in identifiers: |         if isinstance(book.gid, int): | ||||||
|             continue |             if book.gid in identifiers: | ||||||
|  |                 continue | ||||||
|  |         else: | ||||||
|  |             if book.gid["#text"] in identifiers: | ||||||
|  |                 continue | ||||||
|  |  | ||||||
|         if Levenshtein and library_titles: |         if Levenshtein and library_titles: | ||||||
|             goodreads_title = book._book_dict['title_without_series'] |             goodreads_title = book._book_dict['title_without_series'] | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ozzieisaacs
					Ozzieisaacs