From 0c9668f77901e7540e2c7045eb0f2974a4842a69 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 21 Apr 2023 14:55:10 +0200 Subject: Implement remote runner jobs in server Move ffmpeg functions to @shared --- server/lib/transcoding/ended-transcoding.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 server/lib/transcoding/ended-transcoding.ts (limited to 'server/lib/transcoding/ended-transcoding.ts') diff --git a/server/lib/transcoding/ended-transcoding.ts b/server/lib/transcoding/ended-transcoding.ts new file mode 100644 index 000000000..d31674ede --- /dev/null +++ b/server/lib/transcoding/ended-transcoding.ts @@ -0,0 +1,18 @@ +import { retryTransactionWrapper } from '@server/helpers/database-utils' +import { VideoJobInfoModel } from '@server/models/video/video-job-info' +import { MVideo } from '@server/types/models' +import { moveToNextState } from '../video-state' + +export async function onTranscodingEnded (options: { + video: MVideo + isNewVideo: boolean + moveVideoToNextState: boolean +}) { + const { video, isNewVideo, moveVideoToNextState } = options + + await VideoJobInfoModel.decrease(video.uuid, 'pendingTranscode') + + if (moveVideoToNextState) { + await retryTransactionWrapper(moveToNextState, { video, isNewVideo }) + } +} -- cgit v1.2.3