diff --git a/lazylibrarian/api.py b/lazylibrarian/api.py index fc4a63bc..115c5e5f 100644 --- a/lazylibrarian/api.py +++ b/lazylibrarian/api.py @@ -2283,7 +2283,7 @@ class Api: authordata = db.select(f"SELECT AuthorName from authors WHERE {key}='' or {key} is null") api = this_source['api'] - api.__init__() + api = api() for author in authordata: res = api.find_author_id(authorname=author['AuthorName']) if res.get('authorid'): @@ -2302,7 +2302,7 @@ class Api: authorname = format_author_name(kwargs['name'], postfix=get_list(CONFIG.get_csv('NAME_POSTFIX'))) this_source = lazylibrarian.INFOSOURCES[CONFIG['BOOK_API']] api = this_source['api'] - api.__init__() + api = api() myqueue = Queue() search_api = threading.Thread(target=api.find_results, name=f"API-{this_source['src']}RESULTS", @@ -2319,7 +2319,7 @@ class Api: this_source = lazylibrarian.INFOSOURCES[CONFIG['BOOK_API']] api = this_source['api'] - api.__init__() + api = api() myqueue = Queue() search_api = threading.Thread(target=api.find_results, name=f"API-{this_source['src']}RESULTS", diff --git a/lazylibrarian/importer.py b/lazylibrarian/importer.py index ec726bd1..98250f49 100644 --- a/lazylibrarian/importer.py +++ b/lazylibrarian/importer.py @@ -396,12 +396,7 @@ def add_author_to_db(authorname=None, refresh=False, authorid='', addbooks=True, # noinspection PyBroadException try: db.upsert("jobs", {"Start": time.time()}, {"Name": thread_name()}) - authorkeys = [] - for item in lazylibrarian.INFOSOURCES.keys(): - this_source = lazylibrarian.INFOSOURCES[item] - if this_source['author_key'] and this_source['author_key'] != 'authorid': - authorkeys.append(this_source['author_key']) - + authorkeys = author_keys() new_author = True if authorid: cmd = "SELECT * from authors WHERE AuthorID=?" @@ -740,11 +735,8 @@ def de_duplicate(authorid): 'BookImg', 'BookPages', 'BookLink', 'BookFile', 'BookDate', 'BookLang', 'BookAdded', 'WorkPage', 'Manual', 'SeriesDisplay', 'BookLibrary', 'AudioFile', 'AudioLibrary', 'WorkID', 'ScanResult', 'OriginalPubDate', - 'Requester', 'AudioRequester', 'LT_WorkID', 'Narrator'] - - for item in lazylibrarian.INFOSOURCES.keys(): - this_source = lazylibrarian.INFOSOURCES[item] - booktable_keys.append(this_source['book_key']) + 'Requester', 'AudioRequester', 'LT_WorkID', 'Narrator', 'BookID'] + booktable_keys.extend(book_keys()) if author: authorname = author['AuthorName']