1 import { HttpStatusCode, VideoStudioTask } from '@shared/models'
2 import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 export class VideoStudioCommand extends AbstractCommand {
6 static getComplexTask (): VideoStudioTask[] {
21 file: 'video_short.webm'
26 name: 'add-watermark',
36 file: 'video_very_short_240p.mp4'
42 createEditionTasks (options: OverrideCommandOptions & {
43 videoId: number | string
44 tasks: VideoStudioTask[]
46 const path = '/api/v1/videos/' + options.videoId + '/studio/edit'
47 const attaches: { [id: string]: any } = {}
49 for (let i = 0; i < options.tasks.length; i++) {
50 const task = options.tasks[i]
52 if (task.name === 'add-intro' || task.name === 'add-outro' || task.name === 'add-watermark') {
53 attaches[`tasks[${i}][options][file]`] = task.options.file
57 return this.postUploadRequest({
62 fields: { tasks: options.tasks },
64 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204