+
{{ $strings.ButtonSearch }}
@@ -128,7 +128,7 @@ export default {
},
providers() {
if (this.isPodcast) return this.$store.state.scanners.podcastProviders
- return this.$store.state.scanners.providers
+ return [...this.$store.state.scanners.providers, ...this.$store.state.scanners.coverOnlyProviders]
},
searchTitleLabel() {
if (this.provider.startsWith('audible')) return this.$strings.LabelSearchTitleOrASIN
diff --git a/client/store/scanners.js b/client/store/scanners.js
index 0a339a03..9a330f4f 100644
--- a/client/store/scanners.js
+++ b/client/store/scanners.js
@@ -63,6 +63,12 @@ export const state = () => ({
text: 'iTunes',
value: 'itunes'
}
+ ],
+ coverOnlyProviders: [
+ {
+ text: 'AudiobookCovers.com',
+ value: 'audiobookcovers'
+ }
]
})
diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js
index a7d5b730..94981d14 100644
--- a/server/finders/BookFinder.js
+++ b/server/finders/BookFinder.js
@@ -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,12 @@ class BookFinder {
return books
}
+ async getAudiobookCoversResults(search) {
+ const covers = await this.audiobookCovers.search(search)
+ if (this.verbose) Logger.debug(`AudiobookCovers Search Results: ${covers.length || 0}`)
+ return covers || []
+ }
+
async getiTunesAudiobooksResults(title, author) {
return this.iTunesApi.searchAudiobooks(title)
}
@@ -187,6 +195,8 @@ 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)
@@ -202,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 = {}) {
diff --git a/server/providers/AudiobookCovers.js b/server/providers/AudiobookCovers.js
new file mode 100644
index 00000000..edb1b199
--- /dev/null
+++ b/server/providers/AudiobookCovers.js
@@ -0,0 +1,23 @@
+const axios = require('axios')
+const Logger = require('../Logger')
+
+class AudiobookCovers {
+ constructor() { }
+
+ async search(search) {
+ const url = `https://api.audiobookcovers.com/cover/bytext/`
+ const params = new URLSearchParams([['q', search]])
+ const items = await axios.get(url, { params }).then((res) => {
+ if (!res || !res.data) return []
+ return res.data
+ }).catch(error => {
+ Logger.error('[AudiobookCovers] Cover search error', error)
+ return []
+ })
+ return items.map(item => ({ cover: item.filename }))
+ }
+}
+
+
+
+module.exports = AudiobookCovers