Make goodreads compatible for betterreads dependency

This commit is contained in:
Ozzieisaacs 2020-05-06 20:57:54 +02:00
parent 48f4b12c0e
commit 4368c182a0

View File

@ -20,7 +20,10 @@ from __future__ import division, print_function, unicode_literals
import time
from functools import reduce
try:
from goodreads.client import GoodreadsClient
except ImportError:
from betterreads.client import GoodreadsClient
try: import Levenshtein
except ImportError: Levenshtein = False
@ -54,7 +57,7 @@ def connect(key=None, secret=None, enabled=True):
def get_author_info(author_name):
now = time.time()
author_info = _AUTHORS_CACHE.get(author_name, None)
author_info = None # _AUTHORS_CACHE.get(author_name, None)
if author_info:
if now < author_info._timestamp + _CACHE_TIMEOUT:
return author_info
@ -95,6 +98,10 @@ def get_other_books(author_info, library_books=None):
for book in author_info.books:
if book.isbn in identifiers:
continue
if isinstance(book.gid, int):
if book.gid in identifiers:
continue
else:
if book.gid["#text"] in identifiers:
continue