mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 00:18:56 +01:00
Merge branch 'advplyr:master' into dateFormat
This commit is contained in:
commit
7f6baf35b7
@ -180,11 +180,11 @@ class BookFinder {
|
|||||||
Logger.debug(`Book Search: title: "${title}", author: "${author}", provider: ${provider}`)
|
Logger.debug(`Book Search: title: "${title}", author: "${author}", provider: ${provider}`)
|
||||||
|
|
||||||
if (provider === 'google') {
|
if (provider === 'google') {
|
||||||
return this.getGoogleBooksResults(title, author)
|
books = this.getGoogleBooksResults(title, author)
|
||||||
} else if (provider === 'audible') {
|
} else if (provider === 'audible') {
|
||||||
return this.getAudibleResults(title, author, asin)
|
books = this.getAudibleResults(title, author, asin)
|
||||||
} else if (provider === 'itunes') {
|
} else if (provider === 'itunes') {
|
||||||
return this.getiTunesAudiobooksResults(title, author)
|
books = this.getiTunesAudiobooksResults(title, author)
|
||||||
} else if (provider === 'libgen') {
|
} else if (provider === 'libgen') {
|
||||||
books = await this.getLibGenResults(title, author, maxTitleDistance, maxAuthorDistance)
|
books = await this.getLibGenResults(title, author, maxTitleDistance, maxAuthorDistance)
|
||||||
} else if (provider === 'openlibrary') {
|
} else if (provider === 'openlibrary') {
|
||||||
@ -208,6 +208,18 @@ class BookFinder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!books.length && !options.currentlyTryingCleaned) {
|
||||||
|
var cleanedTitle = this.cleanTitleForCompares(title)
|
||||||
|
var cleanedAuthor = this.cleanAuthorForCompares(author)
|
||||||
|
if (cleanedTitle == title && cleanedAuthor == author) return books
|
||||||
|
|
||||||
|
Logger.debug(`Book Search, no matches.. checking cleaned title and author`)
|
||||||
|
options.currentlyTryingCleaned = true
|
||||||
|
return this.search(provider, cleanedTitle, cleanedAuthor, isbn, asin, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (["google", "audible", "itunes"].includes(provider)) return books
|
||||||
|
|
||||||
return books.sort((a, b) => {
|
return books.sort((a, b) => {
|
||||||
return a.totalDistance - b.totalDistance
|
return a.totalDistance - b.totalDistance
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user