diff options
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/handlers/video-file-import.ts | 14 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-transcoding.ts | 7 |
2 files changed, 4 insertions, 17 deletions
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index e6c918e6c..47ae10a66 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts | |||
@@ -7,14 +7,12 @@ import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' | |||
7 | import { generateWebTorrentVideoFilename } from '@server/lib/paths' | 7 | import { generateWebTorrentVideoFilename } from '@server/lib/paths' |
8 | import { addMoveToObjectStorageJob } from '@server/lib/video' | 8 | import { addMoveToObjectStorageJob } from '@server/lib/video' |
9 | import { VideoPathManager } from '@server/lib/video-path-manager' | 9 | import { VideoPathManager } from '@server/lib/video-path-manager' |
10 | import { UserModel } from '@server/models/user/user' | ||
11 | import { MVideoFullLight } from '@server/types/models' | 10 | import { MVideoFullLight } from '@server/types/models' |
12 | import { VideoFileImportPayload, VideoStorage } from '@shared/models' | 11 | import { VideoFileImportPayload, VideoStorage } from '@shared/models' |
13 | import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' | 12 | import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' |
14 | import { logger } from '../../../helpers/logger' | 13 | import { logger } from '../../../helpers/logger' |
15 | import { VideoModel } from '../../../models/video/video' | 14 | import { VideoModel } from '../../../models/video/video' |
16 | import { VideoFileModel } from '../../../models/video/video-file' | 15 | import { VideoFileModel } from '../../../models/video/video-file' |
17 | import { createHlsJobIfEnabled } from './video-transcoding' | ||
18 | 16 | ||
19 | async function processVideoFileImport (job: Job) { | 17 | async function processVideoFileImport (job: Job) { |
20 | const payload = job.data as VideoFileImportPayload | 18 | const payload = job.data as VideoFileImportPayload |
@@ -27,20 +25,8 @@ async function processVideoFileImport (job: Job) { | |||
27 | return undefined | 25 | return undefined |
28 | } | 26 | } |
29 | 27 | ||
30 | const data = await getVideoFileResolution(payload.filePath) | ||
31 | |||
32 | await updateVideoFile(video, payload.filePath) | 28 | await updateVideoFile(video, payload.filePath) |
33 | 29 | ||
34 | const user = await UserModel.loadByChannelActorId(video.VideoChannel.actorId) | ||
35 | |||
36 | await createHlsJobIfEnabled(user, { | ||
37 | videoUUID: video.uuid, | ||
38 | resolution: data.resolution, | ||
39 | isPortraitMode: data.isPortraitMode, | ||
40 | copyCodecs: true, | ||
41 | isMaxQuality: false | ||
42 | }) | ||
43 | |||
44 | if (CONFIG.OBJECT_STORAGE.ENABLED) { | 30 | if (CONFIG.OBJECT_STORAGE.ENABLED) { |
45 | await addMoveToObjectStorageJob(video) | 31 | await addMoveToObjectStorageJob(video) |
46 | } else { | 32 | } else { |
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index b280a1cc9..0143cd02a 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts | |||
@@ -2,7 +2,7 @@ import { Job } from 'bull' | |||
2 | import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils' | 2 | import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils' |
3 | import { addTranscodingJob, getTranscodingJobPriority } from '@server/lib/video' | 3 | import { addTranscodingJob, getTranscodingJobPriority } from '@server/lib/video' |
4 | import { VideoPathManager } from '@server/lib/video-path-manager' | 4 | import { VideoPathManager } from '@server/lib/video-path-manager' |
5 | import { moveToFailedState, moveToNextState } from '@server/lib/video-state' | 5 | import { moveToFailedTranscodingState, moveToNextState } from '@server/lib/video-state' |
6 | import { UserModel } from '@server/models/user/user' | 6 | import { UserModel } from '@server/models/user/user' |
7 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' | 7 | import { VideoJobInfoModel } from '@server/models/video/video-job-info' |
8 | import { MUser, MUserId, MVideo, MVideoFullLight, MVideoWithFile } from '@server/types/models' | 8 | import { MUser, MUserId, MVideo, MVideoFullLight, MVideoWithFile } from '@server/types/models' |
@@ -52,14 +52,15 @@ async function processVideoTranscoding (job: Job) { | |||
52 | const handler = handlers[payload.type] | 52 | const handler = handlers[payload.type] |
53 | 53 | ||
54 | if (!handler) { | 54 | if (!handler) { |
55 | await moveToFailedState(video) | 55 | await moveToFailedTranscodingState(video) |
56 | |||
56 | throw new Error('Cannot find transcoding handler for ' + payload.type) | 57 | throw new Error('Cannot find transcoding handler for ' + payload.type) |
57 | } | 58 | } |
58 | 59 | ||
59 | try { | 60 | try { |
60 | await handler(job, payload, video, user) | 61 | await handler(job, payload, video, user) |
61 | } catch (error) { | 62 | } catch (error) { |
62 | await moveToFailedState(video) | 63 | await moveToFailedTranscodingState(video) |
63 | 64 | ||
64 | throw error | 65 | throw error |
65 | } | 66 | } |