import * as Bluebird from 'bluebird'
import { getUUIDFromFilename } from '../server/helpers/utils'
import { ThumbnailModel } from '../server/models/video/thumbnail'
-import { AvatarModel } from '../server/models/avatar/avatar'
+import { ActorImageModel } from '../server/models/actor/actor-image'
import { uniq, values } from 'lodash'
import { ThumbnailType } from '@shared/models'
let toDelete: string[] = []
+ 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.PREVIEWS_DIR, doesThumbnailExist(true, ThumbnailType.PREVIEW)),
await pruneDirectory(CONFIG.STORAGE.THUMBNAILS_DIR, doesThumbnailExist(false, ThumbnailType.MINIATURE)),
- await pruneDirectory(CONFIG.STORAGE.AVATARS_DIR, doesAvatarExist)
+ await pruneDirectory(CONFIG.STORAGE.ACTOR_IMAGES, doesActorImageExist)
)
const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR)
function doesVideoExist (keepOnlyOwned: boolean) {
return async (file: string) => {
const uuid = getUUIDFromFilename(file)
- const video = await VideoModel.loadByUUID(uuid)
+ const video = await VideoModel.load(uuid)
return video && (keepOnlyOwned === false || video.isOwned())
}
}
}
-async function doesAvatarExist (file: string) {
- const avatar = await AvatarModel.loadByName(file)
+async function doesActorImageExist (file: string) {
+ const image = await ActorImageModel.loadByName(file)
- return !!avatar
+ return !!image
}
async function doesRedundancyExist (file: string) {