X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fprune-storage.ts;h=3012bdb94836ec6f343f9c05a29c3b35dae5b10d;hb=db312c7023bb8263741255f8af1c8a6aef5f88f7;hp=12d78fdc6d3b5aa4d095440d26707afa879f9f0d;hpb=fa66c9a601d69f6d57c956a3513e8bbed7ee9616;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 12d78fdc6..3012bdb94 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts @@ -1,22 +1,19 @@ -import { registerTSPaths } from '../server/helpers/register-ts-paths' -registerTSPaths() - -import { start, get } from 'prompt' -import { join, basename } from 'path' +import { map } from 'bluebird' +import { readdir, remove, stat } from 'fs-extra' +import { basename, join } from 'path' +import { get, start } from 'prompt' +import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' +import { VideoFileModel } from '@server/models/video/video-file' +import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' +import { uniqify } from '@shared/core-utils' +import { ThumbnailType } from '@shared/models' +import { getUUIDFromFilename } from '../server/helpers/utils' import { CONFIG } from '../server/initializers/config' -import { VideoModel } from '../server/models/video/video' import { initDatabaseModels } from '../server/initializers/database' -import { readdir, remove, stat } from 'fs-extra' +import { ActorImageModel } from '../server/models/actor/actor-image' import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy' -import { map } from 'bluebird' -import { getUUIDFromFilename } from '../server/helpers/utils' import { ThumbnailModel } from '../server/models/video/thumbnail' -import { ActorImageModel } from '../server/models/actor/actor-image' -import { uniq, values } from 'lodash' -import { ThumbnailType } from '@shared/models' -import { VideoFileModel } from '@server/models/video/video-file' -import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' -import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' +import { VideoModel } from '../server/models/video/video' run() .then(() => process.exit(0)) @@ -26,9 +23,9 @@ run() }) async function run () { - const dirs = values(CONFIG.STORAGE) + const dirs = Object.values(CONFIG.STORAGE) - if (uniq(dirs).length !== dirs.length) { + if (uniqify(dirs).length !== dirs.length) { console.error('Cannot prune storage because you put multiple storage keys in the same directory.') process.exit(0) }