Skip to content

Commit 2584c3b

Browse files
authored
Merge pull request #2733 from kaldigo/master
Added isbn to CustomProviderAdapter
2 parents b544214 + 94d1732 commit 2584c3b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

server/finders/BookFinder.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,12 @@ class BookFinder {
152152
/**
153153
*
154154
* @param {string} title
155-
* @param {string} author
155+
* @param {string} author
156+
* @param {string} isbn
156157
* @param {string} providerSlug
157158
* @returns {Promise<Object[]>}
158159
*/
159-
async getCustomProviderResults(title, author, providerSlug) {
160+
async getCustomProviderResults(title, author, isbn, providerSlug) {
160161
const books = await this.customProviderAdapter.search(title, author, providerSlug, 'book')
161162
if (this.verbose) Logger.debug(`Custom provider '${providerSlug}' Search Results: ${books.length || 0}`)
162163

@@ -333,7 +334,7 @@ class BookFinder {
333334

334335
// Custom providers are assumed to be correct
335336
if (provider.startsWith('custom-')) {
336-
return this.getCustomProviderResults(title, author, provider)
337+
return this.getCustomProviderResults(title, author, isbn, provider)
337338
}
338339

339340
if (!title)

server/providers/CustomProviderAdapter.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ class CustomProviderAdapter {
99
*
1010
* @param {string} title
1111
* @param {string} author
12+
* @param {string} isbn
1213
* @param {string} providerSlug
1314
* @param {string} mediaType
1415
* @returns {Promise<Object[]>}
1516
*/
16-
async search(title, author, providerSlug, mediaType) {
17+
async search(title, author, isbn, providerSlug, mediaType) {
1718
const providerId = providerSlug.split('custom-')[1]
1819
const provider = await Database.customMetadataProviderModel.findByPk(providerId)
1920

@@ -29,6 +30,9 @@ class CustomProviderAdapter {
2930
if (author) {
3031
queryObj.author = author
3132
}
33+
if (isbn) {
34+
queryObj.isbn = isbn
35+
}
3236
const queryString = (new URLSearchParams(queryObj)).toString()
3337

3438
// Setup headers

0 commit comments

Comments
 (0)