From 221ee1adc916684d4881d2a9c4c01954dcde986e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 9 Nov 2021 11:52:41 +0100 Subject: Add transcoding fail message in client --- server/lib/job-queue/handlers/video-file-import.ts | 14 -------------- server/lib/job-queue/handlers/video-transcoding.ts | 7 ++++--- 2 files changed, 4 insertions(+), 17 deletions(-) (limited to 'server/lib/job-queue') 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' import { generateWebTorrentVideoFilename } from '@server/lib/paths' import { addMoveToObjectStorageJob } from '@server/lib/video' import { VideoPathManager } from '@server/lib/video-path-manager' -import { UserModel } from '@server/models/user/user' import { MVideoFullLight } from '@server/types/models' import { VideoFileImportPayload, VideoStorage } from '@shared/models' import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' import { logger } from '../../../helpers/logger' import { VideoModel } from '../../../models/video/video' import { VideoFileModel } from '../../../models/video/video-file' -import { createHlsJobIfEnabled } from './video-transcoding' async function processVideoFileImport (job: Job) { const payload = job.data as VideoFileImportPayload @@ -27,20 +25,8 @@ async function processVideoFileImport (job: Job) { return undefined } - const data = await getVideoFileResolution(payload.filePath) - await updateVideoFile(video, payload.filePath) - const user = await UserModel.loadByChannelActorId(video.VideoChannel.actorId) - - await createHlsJobIfEnabled(user, { - videoUUID: video.uuid, - resolution: data.resolution, - isPortraitMode: data.isPortraitMode, - copyCodecs: true, - isMaxQuality: false - }) - if (CONFIG.OBJECT_STORAGE.ENABLED) { await addMoveToObjectStorageJob(video) } 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' import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils' import { addTranscodingJob, getTranscodingJobPriority } from '@server/lib/video' import { VideoPathManager } from '@server/lib/video-path-manager' -import { moveToFailedState, moveToNextState } from '@server/lib/video-state' +import { moveToFailedTranscodingState, moveToNextState } from '@server/lib/video-state' import { UserModel } from '@server/models/user/user' import { VideoJobInfoModel } from '@server/models/video/video-job-info' import { MUser, MUserId, MVideo, MVideoFullLight, MVideoWithFile } from '@server/types/models' @@ -52,14 +52,15 @@ async function processVideoTranscoding (job: Job) { const handler = handlers[payload.type] if (!handler) { - await moveToFailedState(video) + await moveToFailedTranscodingState(video) + throw new Error('Cannot find transcoding handler for ' + payload.type) } try { await handler(job, payload, video, user) } catch (error) { - await moveToFailedState(video) + await moveToFailedTranscodingState(video) throw error } -- cgit v1.2.3