mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Fix:Create cache dirs on server init
This commit is contained in:
parent
853858825b
commit
09dc95f560
@ -138,6 +138,7 @@ class Server {
|
|||||||
|
|
||||||
await this.checkUserMediaProgress() // Remove invalid user item progress
|
await this.checkUserMediaProgress() // Remove invalid user item progress
|
||||||
await this.purgeMetadata() // Remove metadata folders without library item
|
await this.purgeMetadata() // Remove metadata folders without library item
|
||||||
|
await this.cacheManager.ensureCachePaths()
|
||||||
|
|
||||||
await this.backupManager.init()
|
await this.backupManager.init()
|
||||||
await this.logManager.init()
|
await this.logManager.init()
|
||||||
|
@ -62,9 +62,6 @@ class CacheManager {
|
|||||||
return ps.pipe(res)
|
return ps.pipe(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write cache
|
|
||||||
await this.ensureCachePaths()
|
|
||||||
|
|
||||||
if (!libraryItem.media.coverPath || !await fs.pathExists(libraryItem.media.coverPath)) {
|
if (!libraryItem.media.coverPath || !await fs.pathExists(libraryItem.media.coverPath)) {
|
||||||
return res.sendStatus(404)
|
return res.sendStatus(404)
|
||||||
}
|
}
|
||||||
@ -88,9 +85,6 @@ class CacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async purgeEntityCache(entityId, cachePath) {
|
async purgeEntityCache(entityId, cachePath) {
|
||||||
// If purgeAll has been called... The cover cache directory no longer exists
|
|
||||||
await this.ensureCachePaths()
|
|
||||||
|
|
||||||
return Promise.all((await fs.readdir(cachePath)).reduce((promises, file) => {
|
return Promise.all((await fs.readdir(cachePath)).reduce((promises, file) => {
|
||||||
if (file.startsWith(entityId)) {
|
if (file.startsWith(entityId)) {
|
||||||
Logger.debug(`[CacheManager] Going to purge ${file}`);
|
Logger.debug(`[CacheManager] Going to purge ${file}`);
|
||||||
@ -117,6 +111,7 @@ class CacheManager {
|
|||||||
Logger.error(`[CacheManager] Failed to remove cache dir "${this.CachePath}"`, error)
|
Logger.error(`[CacheManager] Failed to remove cache dir "${this.CachePath}"`, error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
await this.ensureCachePaths()
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleAuthorCache(res, author, options = {}) {
|
async handleAuthorCache(res, author, options = {}) {
|
||||||
@ -141,9 +136,6 @@ class CacheManager {
|
|||||||
return ps.pipe(res)
|
return ps.pipe(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write cache
|
|
||||||
await this.ensureCachePaths()
|
|
||||||
|
|
||||||
let writtenFile = await resizeImage(author.imagePath, path, width, height)
|
let writtenFile = await resizeImage(author.imagePath, path, width, height)
|
||||||
if (!writtenFile) return res.sendStatus(400)
|
if (!writtenFile) return res.sendStatus(400)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user