diff options
Diffstat (limited to 'server/lib/job-queue/handlers/video-import.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index d6984ef92..ebcb2090c 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -6,7 +6,6 @@ import { VideoImportState } from '../../../../shared/models/videos' | |||
6 | import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' | 6 | import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' |
7 | import { extname, join } from 'path' | 7 | import { extname, join } from 'path' |
8 | import { VideoFileModel } from '../../../models/video/video-file' | 8 | import { VideoFileModel } from '../../../models/video/video-file' |
9 | import { renamePromise, statPromise, unlinkPromise } from '../../../helpers/core-utils' | ||
10 | import { CONFIG, sequelizeTypescript } from '../../../initializers' | 9 | import { CONFIG, sequelizeTypescript } from '../../../initializers' |
11 | import { doRequestAndSaveToFile } from '../../../helpers/requests' | 10 | import { doRequestAndSaveToFile } from '../../../helpers/requests' |
12 | import { VideoState } from '../../../../shared' | 11 | import { VideoState } from '../../../../shared' |
@@ -15,6 +14,7 @@ import { federateVideoIfNeeded } from '../../activitypub' | |||
15 | import { VideoModel } from '../../../models/video/video' | 14 | import { VideoModel } from '../../../models/video/video' |
16 | import { downloadWebTorrentVideo } from '../../../helpers/webtorrent' | 15 | import { downloadWebTorrentVideo } from '../../../helpers/webtorrent' |
17 | import { getSecureTorrentName } from '../../../helpers/utils' | 16 | import { getSecureTorrentName } from '../../../helpers/utils' |
17 | import { rename, stat } from 'fs-extra' | ||
18 | 18 | ||
19 | type VideoImportYoutubeDLPayload = { | 19 | type VideoImportYoutubeDLPayload = { |
20 | type: 'youtube-dl' | 20 | type: 'youtube-dl' |
@@ -114,7 +114,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide | |||
114 | tempVideoPath = await downloader() | 114 | tempVideoPath = await downloader() |
115 | 115 | ||
116 | // Get information about this video | 116 | // Get information about this video |
117 | const stats = await statPromise(tempVideoPath) | 117 | const stats = await stat(tempVideoPath) |
118 | const isAble = await videoImport.User.isAbleToUploadVideo({ size: stats.size }) | 118 | const isAble = await videoImport.User.isAbleToUploadVideo({ size: stats.size }) |
119 | if (isAble === false) { | 119 | if (isAble === false) { |
120 | throw new Error('The user video quota is exceeded with this video to import.') | 120 | throw new Error('The user video quota is exceeded with this video to import.') |
@@ -138,7 +138,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide | |||
138 | 138 | ||
139 | // Move file | 139 | // Move file |
140 | videoDestFile = join(CONFIG.STORAGE.VIDEOS_DIR, videoImport.Video.getVideoFilename(videoFile)) | 140 | videoDestFile = join(CONFIG.STORAGE.VIDEOS_DIR, videoImport.Video.getVideoFilename(videoFile)) |
141 | await renamePromise(tempVideoPath, videoDestFile) | 141 | await rename(tempVideoPath, videoDestFile) |
142 | tempVideoPath = null // This path is not used anymore | 142 | tempVideoPath = null // This path is not used anymore |
143 | 143 | ||
144 | // Process thumbnail | 144 | // Process thumbnail |