X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fjob-queue%2Fhandlers%2Fvideo-file-import.ts;h=be9e7d181b0e65aa91ab29176a0edc8c69302bba;hb=a3b7421abb4192e215aa280418b62e96958c5e42;hp=5c5b7dccb77c5bac463080d492427d1b4ee5e2b3;hpb=8c559fad1e1c4c2ab7f1388c73200aa4c6256d74;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index 5c5b7dccb..be9e7d181 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts @@ -7,9 +7,11 @@ import { copy, stat } from 'fs-extra' import { VideoFileModel } from '../../../models/video/video-file' import { extname } from 'path' import { MVideoFile, MVideoWithFile } from '@server/typings/models' +import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' +import { getVideoFilePath } from '@server/lib/video-paths' export type VideoFileImportPayload = { - videoUUID: string, + videoUUID: string filePath: string } @@ -68,10 +70,10 @@ async function updateVideoFile (video: MVideoWithFile, inputFilePath: string) { 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()