2017-11-10 10:27:49 -06:00
|
|
|
import { JobCategory } from '../../../../shared'
|
2017-12-12 10:53:50 -06:00
|
|
|
import { VideoModel } from '../../../models/video/video'
|
2017-11-10 10:27:49 -06:00
|
|
|
import { JobHandler, JobScheduler } from '../job-scheduler'
|
2017-12-12 10:53:50 -06:00
|
|
|
|
2017-11-09 10:51:58 -06:00
|
|
|
import * as videoFileOptimizer from './video-file-optimizer-handler'
|
|
|
|
import * as videoFileTranscoder from './video-file-transcoder-handler'
|
|
|
|
|
2017-11-10 10:27:49 -06:00
|
|
|
type TranscodingJobPayload = {
|
|
|
|
videoUUID: string
|
|
|
|
resolution?: number
|
|
|
|
}
|
2017-12-12 10:53:50 -06:00
|
|
|
const jobHandlers: { [ handlerName: string ]: JobHandler<TranscodingJobPayload, VideoModel> } = {
|
2017-11-09 10:51:58 -06:00
|
|
|
videoFileOptimizer,
|
|
|
|
videoFileTranscoder
|
|
|
|
}
|
|
|
|
const jobCategory: JobCategory = 'transcoding'
|
|
|
|
|
|
|
|
const transcodingJobScheduler = new JobScheduler(jobCategory, jobHandlers)
|
|
|
|
|
|
|
|
export {
|
2017-11-10 10:27:49 -06:00
|
|
|
TranscodingJobPayload,
|
2017-11-09 10:51:58 -06:00
|
|
|
transcodingJobScheduler
|
|
|
|
}
|