import { copy, stat } from 'fs-extra'
import { VideoFileModel } from '../../../models/video/video-file'
import { extname } from 'path'
-import { MVideoFile, MVideoWithFile } from '@server/typings/models'
-
-export type VideoFileImportPayload = {
- videoUUID: string,
- filePath: string
-}
+import { MVideoFile, MVideoWithFile } from '@server/types/models'
+import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
+import { getVideoFilePath } from '@server/lib/video-paths'
+import { VideoFileImportPayload } from '@shared/models'
async function processVideoFileImport (job: Bull.Job) {
const payload = job.data as VideoFileImportPayload
updatedVideoFile = currentVideoFile
}
- const outputPath = video.getVideoFilePath(updatedVideoFile)
+ const outputPath = getVideoFilePath(video, updatedVideoFile)
await copy(inputFilePath, outputPath)
- await video.createTorrentAndSetInfoHash(updatedVideoFile)
+ await createTorrentAndSetInfoHash(video, updatedVideoFile)
await updatedVideoFile.save()