mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-09 21:39:37 +00:00
Add cover finder to new book scanner
This commit is contained in:
parent
934c0b9093
commit
efae529fac
14 changed files with 188 additions and 98 deletions
|
|
@ -6,13 +6,21 @@ const { resizeImage } = require('../utils/ffmpegHelpers')
|
|||
|
||||
class CacheManager {
|
||||
constructor() {
|
||||
this.CachePath = null
|
||||
this.CoverCachePath = null
|
||||
this.ImageCachePath = null
|
||||
this.ItemCachePath = null
|
||||
}
|
||||
|
||||
/**
|
||||
* Create cache directory paths if they dont exist
|
||||
*/
|
||||
async ensureCachePaths() { // Creates cache paths if necessary and sets owner and permissions
|
||||
this.CachePath = Path.join(global.MetadataPath, 'cache')
|
||||
this.CoverCachePath = Path.join(this.CachePath, 'covers')
|
||||
this.ImageCachePath = Path.join(this.CachePath, 'images')
|
||||
this.ItemCachePath = Path.join(this.CachePath, 'items')
|
||||
}
|
||||
|
||||
async ensureCachePaths() { // Creates cache paths if necessary and sets owner and permissions
|
||||
if (!(await fs.pathExists(this.CachePath))) {
|
||||
await fs.mkdir(this.CachePath)
|
||||
}
|
||||
|
|
@ -151,4 +159,4 @@ class CacheManager {
|
|||
readStream.pipe(res)
|
||||
}
|
||||
}
|
||||
module.exports = CacheManager
|
||||
module.exports = new CacheManager()
|
||||
Loading…
Add table
Add a link
Reference in a new issue