mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-15 22:01:37 +00:00
Add kindle provider
This commit is contained in:
parent
565ff36d4e
commit
fe1edd24bc
5 changed files with 767 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
|||
const OpenLibrary = require('../providers/OpenLibrary')
|
||||
const GoogleBooks = require('../providers/GoogleBooks')
|
||||
const Kindle = require('../providers/Kindle')
|
||||
const Audible = require('../providers/Audible')
|
||||
const iTunes = require('../providers/iTunes')
|
||||
const Audnexus = require('../providers/Audnexus')
|
||||
|
|
@ -12,13 +13,14 @@ class BookFinder {
|
|||
constructor() {
|
||||
this.openLibrary = new OpenLibrary()
|
||||
this.googleBooks = new GoogleBooks()
|
||||
this.kindle = new Kindle()
|
||||
this.audible = new Audible()
|
||||
this.iTunesApi = new iTunes()
|
||||
this.audnexus = new Audnexus()
|
||||
this.fantLab = new FantLab()
|
||||
this.audiobookCovers = new AudiobookCovers()
|
||||
|
||||
this.providers = ['google', 'itunes', 'openlibrary', 'fantlab', 'audiobookcovers', 'audible', 'audible.ca', 'audible.uk', 'audible.au', 'audible.fr', 'audible.de', 'audible.jp', 'audible.it', 'audible.in', 'audible.es']
|
||||
this.providers = ['google', 'kindle', 'itunes', 'openlibrary', 'fantlab', 'audiobookcovers', 'audible', 'audible.ca', 'audible.uk', 'audible.au', 'audible.fr', 'audible.de', 'audible.jp', 'audible.it', 'audible.in', 'audible.es']
|
||||
|
||||
this.verbose = false
|
||||
}
|
||||
|
|
@ -150,6 +152,16 @@ class BookFinder {
|
|||
return books
|
||||
}
|
||||
|
||||
async getKindleResults(title, author) {
|
||||
var books = await this.kindle.search(title, author)
|
||||
if (this.verbose) Logger.debug(`Kindle Book Search Results: ${books.length || 0}`)
|
||||
if (books.errorCode) {
|
||||
Logger.error(`Kindle Search Error ${books.errorCode}`)
|
||||
return []
|
||||
}
|
||||
return books
|
||||
}
|
||||
|
||||
async getFantLabResults(title, author) {
|
||||
var books = await this.fantLab.search(title, author)
|
||||
if (this.verbose) Logger.debug(`FantLab Book Search Results: ${books.length || 0}`)
|
||||
|
|
@ -309,6 +321,8 @@ class BookFinder {
|
|||
|
||||
if (provider === 'google') {
|
||||
books = await this.getGoogleBooksResults(title, author)
|
||||
} else if (provider === 'kindle') {
|
||||
books = await this.getKindleResults(title, author)
|
||||
} else if (provider.startsWith('audible')) {
|
||||
books = await this.getAudibleResults(title, author, asin, provider)
|
||||
} else if (provider === 'itunes') {
|
||||
|
|
@ -319,8 +333,7 @@ class BookFinder {
|
|||
books = await this.getFantLabResults(title, author)
|
||||
} else if (provider === 'audiobookcovers') {
|
||||
books = await this.getAudiobookCoversResults(title)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
books = await this.getGoogleBooksResults(title, author)
|
||||
}
|
||||
return books
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue