diff options
Diffstat (limited to 'server/lib/job-queue/handlers/video-file-import.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-file-import.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index 187cb652e..4d199f247 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts | |||
@@ -2,7 +2,7 @@ import * as Bull from 'bull' | |||
2 | import { copy, stat } from 'fs-extra' | 2 | import { copy, stat } from 'fs-extra' |
3 | import { getLowercaseExtension } from '@server/helpers/core-utils' | 3 | import { getLowercaseExtension } from '@server/helpers/core-utils' |
4 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' | 4 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' |
5 | import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' | 5 | import { generateWebTorrentVideoFilename, getVideoFilePath } from '@server/lib/video-paths' |
6 | import { UserModel } from '@server/models/user/user' | 6 | import { UserModel } from '@server/models/user/user' |
7 | import { MVideoFullLight } from '@server/types/models' | 7 | import { MVideoFullLight } from '@server/types/models' |
8 | import { VideoFileImportPayload } from '@shared/models' | 8 | import { VideoFileImportPayload } from '@shared/models' |
@@ -61,8 +61,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) { | |||
61 | 61 | ||
62 | if (currentVideoFile) { | 62 | if (currentVideoFile) { |
63 | // Remove old file and old torrent | 63 | // Remove old file and old torrent |
64 | await video.removeFile(currentVideoFile) | 64 | await video.removeFileAndTorrent(currentVideoFile) |
65 | await currentVideoFile.removeTorrent() | ||
66 | // Remove the old video file from the array | 65 | // Remove the old video file from the array |
67 | video.VideoFiles = video.VideoFiles.filter(f => f !== currentVideoFile) | 66 | video.VideoFiles = video.VideoFiles.filter(f => f !== currentVideoFile) |
68 | 67 | ||
@@ -72,7 +71,7 @@ async function updateVideoFile (video: MVideoFullLight, inputFilePath: string) { | |||
72 | const newVideoFile = new VideoFileModel({ | 71 | const newVideoFile = new VideoFileModel({ |
73 | resolution: videoFileResolution, | 72 | resolution: videoFileResolution, |
74 | extname: fileExt, | 73 | extname: fileExt, |
75 | filename: generateVideoFilename(video, false, videoFileResolution, fileExt), | 74 | filename: generateWebTorrentVideoFilename(videoFileResolution, fileExt), |
76 | size, | 75 | size, |
77 | fps, | 76 | fps, |
78 | videoId: video.id | 77 | videoId: video.id |