]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/prune-storage.ts
Only display homepage when components are loaded
[github/Chocobozzz/PeerTube.git] / scripts / prune-storage.ts
index bdfb335c61aeb7a28d4c74b94b510b7cf6aef3d4..58d24816e345e5e60c966c97999add985c31d63a 100755 (executable)
@@ -11,7 +11,7 @@ import { VideoRedundancyModel } from '../server/models/redundancy/video-redundan
 import * as Bluebird from 'bluebird'
 import { getUUIDFromFilename } from '../server/helpers/utils'
 import { ThumbnailModel } from '../server/models/video/thumbnail'
-import { ActorImageModel } from '../server/models/account/actor-image'
+import { ActorImageModel } from '../server/models/actor/actor-image'
 import { uniq, values } from 'lodash'
 import { ThumbnailType } from '@shared/models'
 
@@ -34,6 +34,8 @@ async function run () {
 
   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)),
@@ -87,7 +89,7 @@ async function pruneDirectory (directory: string, existFun: ExistFun) {
 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())
   }