Add cover finder to new book scanner

This commit is contained in:
advplyr 2023-09-06 17:48:50 -05:00
parent 934c0b9093
commit efae529fac
14 changed files with 188 additions and 98 deletions

View file

@ -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()