From 819c524f5192306d2aec5dd1ee2e9a929755714a Mon Sep 17 00:00:00 2001 From: mikiher Date: Wed, 8 Nov 2023 16:19:24 +0000 Subject: [PATCH] Pass audnexus to AuthorCandidates constructor directly --- server/finders/BookFinder.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js index fa034bce..ac3de2a7 100644 --- a/server/finders/BookFinder.js +++ b/server/finders/BookFinder.js @@ -233,15 +233,15 @@ class BookFinder { } static AuthorCandidates = class { - constructor(bookFinder, cleanAuthor) { - this.bookFinder = bookFinder + constructor(cleanAuthor, audnexus) { + this.audnexus = audnexus this.candidates = new Set() this.cleanAuthor = cleanAuthor if (cleanAuthor) this.candidates.add(cleanAuthor) } validateAuthor(name, region = '', maxLevenshtein = 2) { - return this.bookFinder.audnexus.authorASINsRequest(name, region).then((asins) => { + return this.audnexus.authorASINsRequest(name, region).then((asins) => { for (const [i, asin] of asins.entries()) { if (i > 10) break let cleanName = cleanAuthorForCompares(asin.name) @@ -326,7 +326,7 @@ class BookFinder { const cleanAuthor = cleanAuthorForCompares(author) // Now run up to maxFuzzySearches fuzzy searches - let authorCandidates = new BookFinder.AuthorCandidates(this, cleanAuthor) + let authorCandidates = new BookFinder.AuthorCandidates(cleanAuthor, this.audnexus) // Remove underscores and parentheses with their contents, and replace with a separator const cleanTitle = title.replace(/\[.*?\]|\(.*?\)|{.*?}|_/g, " - ")