mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Update:Max levenshtein distance for matching author names to 3 #572
This commit is contained in:
parent
f34ebdc016
commit
2103edfcdc
@ -21,7 +21,7 @@ class AuthorFinder {
|
|||||||
|
|
||||||
async findAuthorByName(name, options = {}) {
|
async findAuthorByName(name, options = {}) {
|
||||||
if (!name) return null
|
if (!name) return null
|
||||||
const maxLevenshtein = !isNaN(options.maxLevenshtein) ? Number(options.maxLevenshtein) : 2
|
const maxLevenshtein = !isNaN(options.maxLevenshtein) ? Number(options.maxLevenshtein) : 3
|
||||||
|
|
||||||
var author = await this.audnexus.findAuthorByName(name, maxLevenshtein)
|
var author = await this.audnexus.findAuthorByName(name, maxLevenshtein)
|
||||||
if (!author || !author.name) {
|
if (!author || !author.name) {
|
||||||
|
@ -27,7 +27,7 @@ class Audnexus {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async findAuthorByName(name, maxLevenshtein = 2) {
|
async findAuthorByName(name, maxLevenshtein = 3) {
|
||||||
Logger.debug(`[Audnexus] Looking up author by name ${name}`)
|
Logger.debug(`[Audnexus] Looking up author by name ${name}`)
|
||||||
var asins = await this.authorASINsRequest(name)
|
var asins = await this.authorASINsRequest(name)
|
||||||
var matchingAsin = asins.find(obj => levenshteinDistance(obj.name, name) <= maxLevenshtein)
|
var matchingAsin = asins.find(obj => levenshteinDistance(obj.name, name) <= maxLevenshtein)
|
||||||
|
Loading…
Reference in New Issue
Block a user