mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Auto-formatting
This commit is contained in:
parent
e9e9a8ba75
commit
ee501f70ed
@ -73,8 +73,8 @@ class Audnexus {
|
|||||||
Logger.info(`[Audnexus] Searching for author "${authorRequestUrl}"`)
|
Logger.info(`[Audnexus] Searching for author "${authorRequestUrl}"`)
|
||||||
|
|
||||||
return this._processRequest(this.limiter(() => axios.get(authorRequestUrl)))
|
return this._processRequest(this.limiter(() => axios.get(authorRequestUrl)))
|
||||||
.then(res => res.data)
|
.then((res) => res.data)
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
Logger.error(`[Audnexus] Author request failed for ${asin}`, error)
|
Logger.error(`[Audnexus] Author request failed for ${asin}`, error)
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
@ -89,13 +89,14 @@ class Audnexus {
|
|||||||
async findAuthorByASIN(asin, region) {
|
async findAuthorByASIN(asin, region) {
|
||||||
const author = await this.authorRequest(asin, region)
|
const author = await this.authorRequest(asin, region)
|
||||||
|
|
||||||
return author ?
|
return author
|
||||||
{
|
? {
|
||||||
asin: author.asin,
|
asin: author.asin,
|
||||||
description: author.description,
|
description: author.description,
|
||||||
image: author.image || null,
|
image: author.image || null,
|
||||||
name: author.name
|
name: author.name
|
||||||
} : null
|
}
|
||||||
|
: null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -138,8 +139,8 @@ class Audnexus {
|
|||||||
Logger.debug(`[Audnexus] Get chapters for ASIN ${asin}/${region}`)
|
Logger.debug(`[Audnexus] Get chapters for ASIN ${asin}/${region}`)
|
||||||
|
|
||||||
return this._processRequest(this.limiter(() => axios.get(`${this.baseUrl}/books/${asin}/chapters?region=${region}`)))
|
return this._processRequest(this.limiter(() => axios.get(`${this.baseUrl}/books/${asin}/chapters?region=${region}`)))
|
||||||
.then(res => res.data)
|
.then((res) => res.data)
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
Logger.error(`[Audnexus] Chapter ASIN request failed for ${asin}/${region}`, error)
|
Logger.error(`[Audnexus] Chapter ASIN request failed for ${asin}/${region}`, error)
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
@ -156,7 +157,7 @@ class Audnexus {
|
|||||||
const retryAfter = parseInt(error.response.headers?.['retry-after'], 10) || 5
|
const retryAfter = parseInt(error.response.headers?.['retry-after'], 10) || 5
|
||||||
|
|
||||||
Logger.warn(`[Audnexus] Rate limit exceeded. Retrying in ${retryAfter} seconds.`)
|
Logger.warn(`[Audnexus] Rate limit exceeded. Retrying in ${retryAfter} seconds.`)
|
||||||
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000))
|
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000))
|
||||||
|
|
||||||
return this._processRequest(request)
|
return this._processRequest(request)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user