import { registerTSPaths } from '../server/helpers/register-ts-paths'
registerTSPaths()
-import * as prompt from 'prompt'
+import { start, get } from 'prompt'
import { join, basename } from 'path'
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 { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy'
-import * as Bluebird from 'bluebird'
+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 } from '@server/initializers/constants'
run()
.then(() => process.exit(0))
const files = await readdir(directory)
const toDelete: string[] = []
- await Bluebird.map(files, async file => {
+ await map(files, async file => {
const filePath = join(directory, file)
if (await existFun(filePath) !== true) {
const isPlaylist = (await stat(filePath)).isDirectory()
if (isPlaylist) {
+ // Don't delete HLS directory
+ if (filePath === HLS_REDUNDANCY_DIRECTORY) return true
+
const uuid = getUUIDFromFilename(filePath)
const video = await VideoModel.loadWithFiles(uuid)
if (!video) return false
async function askConfirmation () {
return new Promise((res, rej) => {
- prompt.start()
+ start()
const schema = {
properties: {
confirm: {
}
}
}
- prompt.get(schema, function (err, result) {
+ get(schema, function (err, result) {
if (err) return rej(err)
return res(result.confirm?.match(/y/) !== null)