mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-24 04:44:57 +02:00
Add AudiobookCovers.com metadata provider
AudiobookCovers.com acts as a cover-only metadata provider, therefore will only show up in the covers selector.
This commit is contained in:
parent
6ae3ad508e
commit
f9ed412e4e
4 changed files with 51 additions and 3 deletions
|
@ -4,6 +4,7 @@ const Audible = require('../providers/Audible')
|
|||
const iTunes = require('../providers/iTunes')
|
||||
const Audnexus = require('../providers/Audnexus')
|
||||
const FantLab = require('../providers/FantLab')
|
||||
const AudiobookCovers = require('../providers/AudiobookCovers')
|
||||
const Logger = require('../Logger')
|
||||
const { levenshteinDistance } = require('../utils/index')
|
||||
|
||||
|
@ -15,6 +16,7 @@ class BookFinder {
|
|||
this.iTunesApi = new iTunes()
|
||||
this.audnexus = new Audnexus()
|
||||
this.fantLab = new FantLab()
|
||||
this.audiobookCovers = new AudiobookCovers()
|
||||
|
||||
this.verbose = false
|
||||
}
|
||||
|
@ -159,6 +161,16 @@ class BookFinder {
|
|||
return books
|
||||
}
|
||||
|
||||
async getAudiobookCoversResults(search) {
|
||||
const covers = await this.audiobookCovers.search(search)
|
||||
if (this.verbose) Logger.debug(`AudiobookCovers Book Search Results: ${books.length || 0}`)
|
||||
if (covers.errorCode) {
|
||||
Logger.error(`AusiobookCovers Search Error ${books.errorCode}`)
|
||||
return []
|
||||
}
|
||||
return covers
|
||||
}
|
||||
|
||||
async getiTunesAudiobooksResults(title, author) {
|
||||
return this.iTunesApi.searchAudiobooks(title)
|
||||
}
|
||||
|
@ -187,11 +199,15 @@ class BookFinder {
|
|||
books = await this.getOpenLibResults(title, author, maxTitleDistance, maxAuthorDistance)
|
||||
} else if (provider === 'fantlab') {
|
||||
books = await this.getFantLabResults(title, author)
|
||||
} else if (provider === 'audiobookcovers') {
|
||||
books = await this.getAudiobookCoversResults(title)
|
||||
}
|
||||
else {
|
||||
books = await this.getGoogleBooksResults(title, author)
|
||||
}
|
||||
|
||||
console.log(books)
|
||||
|
||||
if (!books.length && !options.currentlyTryingCleaned) {
|
||||
var cleanedTitle = this.cleanTitleForCompares(title)
|
||||
var cleanedAuthor = this.cleanAuthorForCompares(author)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue