Cleanup audiobookcovers.com addition

This commit is contained in:
advplyr 2023-04-21 16:17:52 -05:00
parent 1342897858
commit 84839bea44
3 changed files with 10 additions and 14 deletions

View File

@ -49,7 +49,7 @@
</div>
<form @submit.prevent="submitSearchForm">
<div class="flex items-center justify-start -mx-1 h-20">
<div class="w-45 px-1">
<div class="w-48 px-1">
<ui-dropdown v-model="provider" :items="providers" :label="$strings.LabelProvider" small />
</div>
<div class="w-72 px-1">

View File

@ -163,12 +163,8 @@ class BookFinder {
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
if (this.verbose) Logger.debug(`AudiobookCovers Search Results: ${covers.length || 0}`)
return covers || []
}
async getiTunesAudiobooksResults(title, author) {
@ -206,8 +202,6 @@ class BookFinder {
books = await this.getGoogleBooksResults(title, author)
}
console.log(books)
if (!books.length && !options.currentlyTryingCleaned) {
var cleanedTitle = this.cleanTitleForCompares(title)
var cleanedAuthor = this.cleanAuthorForCompares(author)
@ -218,11 +212,13 @@ class BookFinder {
return this.search(provider, cleanedTitle, cleanedAuthor, isbn, asin, options)
}
if (["google", "audible", "itunes", 'fantlab'].includes(provider)) return books
if (provider === 'openlibrary') {
books.sort((a, b) => {
return a.totalDistance - b.totalDistance
})
}
return books.sort((a, b) => {
return a.totalDistance - b.totalDistance
})
return books
}
async findCovers(provider, title, author, options = {}) {

View File

@ -14,7 +14,7 @@ class AudiobookCovers {
Logger.error('[AudiobookCovers] Cover search error', error)
return []
})
return items.map(item => { return { cover: item.filename } })
return items.map(item => ({ cover: item.filename }))
}
}