- for (const directory of storageToPrune) {
- toDelete = toDelete.concat(await pruneDirectory(directory))
- }
+
+ console.log('Detecting files to remove, it could take a while...')
+
+ toDelete = toDelete.concat(
+ await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesVideoExist(true)),
+ await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesVideoExist(true)),
+
+ await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist),
+
+ await pruneDirectory(CONFIG.STORAGE.PREVIEWS_DIR, doesThumbnailExist(true, ThumbnailType.PREVIEW)),
+ await pruneDirectory(CONFIG.STORAGE.THUMBNAILS_DIR, doesThumbnailExist(false, ThumbnailType.MINIATURE)),
+
+ await pruneDirectory(CONFIG.STORAGE.ACTOR_IMAGES, doesActorImageExist)
+ )
+
+ const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR)
+ toDelete = toDelete.concat(tmpFiles.map(t => join(CONFIG.STORAGE.TMP_DIR, t)))