Code tidying

This commit is contained in:
phil.borman@gmail.com 2026-02-05 18:27:22 +01:00
parent 439ddd6657
commit 3dd2f0da1f
2 changed files with 6 additions and 14 deletions

View File

@ -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",

View File

@ -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']