diff options
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index e5730e746..11ccd47ed 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -21,9 +21,9 @@ import { | |||
21 | VideoImportYoutubeDLPayloadType, | 21 | VideoImportYoutubeDLPayloadType, |
22 | VideoState | 22 | VideoState |
23 | } from '../../../../shared' | 23 | } from '../../../../shared' |
24 | import { VideoImportState } from '../../../../shared/models/videos' | 24 | import { VideoImportState, VideoResolution } from '../../../../shared/models/videos' |
25 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' | 25 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' |
26 | import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' | 26 | import { ffprobePromise, getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' |
27 | import { logger } from '../../../helpers/logger' | 27 | import { logger } from '../../../helpers/logger' |
28 | import { getSecureTorrentName } from '../../../helpers/utils' | 28 | import { getSecureTorrentName } from '../../../helpers/utils' |
29 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' | 29 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' |
@@ -36,6 +36,7 @@ import { MThumbnail } from '../../../types/models/video/thumbnail' | |||
36 | import { federateVideoIfNeeded } from '../../activitypub/videos' | 36 | import { federateVideoIfNeeded } from '../../activitypub/videos' |
37 | import { Notifier } from '../../notifier' | 37 | import { Notifier } from '../../notifier' |
38 | import { generateVideoMiniature } from '../../thumbnail' | 38 | import { generateVideoMiniature } from '../../thumbnail' |
39 | import { isAudioFile } from '@shared/extra-utils' | ||
39 | 40 | ||
40 | async function processVideoImport (job: Job) { | 41 | async function processVideoImport (job: Job) { |
41 | const payload = job.data as VideoImportPayload | 42 | const payload = job.data as VideoImportPayload |
@@ -114,9 +115,14 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid | |||
114 | throw new Error('The user video quota is exceeded with this video to import.') | 115 | throw new Error('The user video quota is exceeded with this video to import.') |
115 | } | 116 | } |
116 | 117 | ||
117 | const { resolution } = await getVideoFileResolution(tempVideoPath) | 118 | const probe = await ffprobePromise(tempVideoPath) |
118 | const fps = await getVideoFileFPS(tempVideoPath) | 119 | |
119 | const duration = await getDurationFromVideoFile(tempVideoPath) | 120 | const { resolution } = await isAudioFile(tempVideoPath, probe) |
121 | ? await getVideoFileResolution(tempVideoPath) | ||
122 | : { resolution: VideoResolution.H_NOVIDEO } | ||
123 | |||
124 | const fps = await getVideoFileFPS(tempVideoPath, probe) | ||
125 | const duration = await getDurationFromVideoFile(tempVideoPath, probe) | ||
120 | 126 | ||
121 | // Prepare video file object for creation in database | 127 | // Prepare video file object for creation in database |
122 | const fileExt = getLowercaseExtension(tempVideoPath) | 128 | const fileExt = getLowercaseExtension(tempVideoPath) |