mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 09:49:24 +02:00
Update match all books to load items from DB, remove library items loading to memory on init
This commit is contained in:
parent
03115e5e53
commit
1dd1fe8994
19 changed files with 127 additions and 140 deletions
|
@ -5,6 +5,7 @@ const { createNewSortInstance } = require('../libs/fastSort')
|
|||
const Logger = require('../Logger')
|
||||
const SocketAuthority = require('../SocketAuthority')
|
||||
const Database = require('../Database')
|
||||
const AuthorFinder = require('../finders/AuthorFinder')
|
||||
|
||||
const { reqSupportsWebp } = require('../utils/index')
|
||||
|
||||
|
@ -70,7 +71,7 @@ class AuthorController {
|
|||
await this.cacheManager.purgeImageCache(req.author.id) // Purge cache
|
||||
await this.coverManager.removeFile(req.author.imagePath)
|
||||
} else if (payload.imagePath.startsWith('http')) { // Check if image path is a url
|
||||
const imageData = await this.authorFinder.saveAuthorImage(req.author.id, payload.imagePath)
|
||||
const imageData = await AuthorFinder.saveAuthorImage(req.author.id, payload.imagePath)
|
||||
if (imageData) {
|
||||
if (req.author.imagePath) {
|
||||
await this.cacheManager.purgeImageCache(req.author.id) // Purge cache
|
||||
|
@ -168,9 +169,9 @@ class AuthorController {
|
|||
let authorData = null
|
||||
const region = req.body.region || 'us'
|
||||
if (req.body.asin) {
|
||||
authorData = await this.authorFinder.findAuthorByASIN(req.body.asin, region)
|
||||
authorData = await AuthorFinder.findAuthorByASIN(req.body.asin, region)
|
||||
} else {
|
||||
authorData = await this.authorFinder.findAuthorByName(req.body.q, region)
|
||||
authorData = await AuthorFinder.findAuthorByName(req.body.q, region)
|
||||
}
|
||||
if (!authorData) {
|
||||
return res.status(404).send('Author not found')
|
||||
|
@ -187,7 +188,7 @@ class AuthorController {
|
|||
if (authorData.image && (!req.author.imagePath || hasUpdates)) {
|
||||
this.cacheManager.purgeImageCache(req.author.id)
|
||||
|
||||
const imageData = await this.authorFinder.saveAuthorImage(req.author.id, authorData.image)
|
||||
const imageData = await AuthorFinder.saveAuthorImage(req.author.id, authorData.image)
|
||||
if (imageData) {
|
||||
req.author.imagePath = imageData.path
|
||||
hasUpdates = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue