You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
772 B
TypeScript
22 lines
772 B
TypeScript
import { VideoTranscriptionPayload } from '@peertube/peertube-models'
|
|||
import { generateSubtitle } from '@server/lib/video-captions.js'
|
|||
import { Job } from 'bullmq'
|
|||
import { logger, loggerTagsFactory } from '../../../helpers/logger.js'
|
|||
import { VideoModel } from '../../../models/video/video.js'
|
|||
|
|||
const lTags = loggerTagsFactory('transcription')
|
|||
|
|||
export async function processVideoTranscription (job: Job) {
|
|||
const payload = job.data as VideoTranscriptionPayload
|
|||
|
|||
logger.info('Processing video transcription in job %s.', job.id)
|
|||
|
|||
const video = await VideoModel.load(payload.videoUUID)
|
|||
if (!video) {
|
|||
logger.info('Do not process transcription job %d, video does not exist.', job.id, lTags(payload.videoUUID))
|
|||
return
|
|||
}
|
|||
|
|||
return generateSubtitle({ video })
|
|||
}
|