diff options
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r-- | server/controllers/api/videos/index.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/videos/studio.ts (renamed from server/controllers/api/videos/editor.ts) | 44 |
2 files changed, 24 insertions, 24 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index a5ae07d95..c7617093c 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -35,7 +35,7 @@ import { VideoModel } from '../../../models/video/video' | |||
35 | import { blacklistRouter } from './blacklist' | 35 | import { blacklistRouter } from './blacklist' |
36 | import { videoCaptionsRouter } from './captions' | 36 | import { videoCaptionsRouter } from './captions' |
37 | import { videoCommentRouter } from './comment' | 37 | import { videoCommentRouter } from './comment' |
38 | import { editorRouter } from './editor' | 38 | import { studioRouter } from './studio' |
39 | import { filesRouter } from './files' | 39 | import { filesRouter } from './files' |
40 | import { videoImportsRouter } from './import' | 40 | import { videoImportsRouter } from './import' |
41 | import { liveRouter } from './live' | 41 | import { liveRouter } from './live' |
@@ -52,7 +52,7 @@ const videosRouter = express.Router() | |||
52 | videosRouter.use('/', blacklistRouter) | 52 | videosRouter.use('/', blacklistRouter) |
53 | videosRouter.use('/', rateVideoRouter) | 53 | videosRouter.use('/', rateVideoRouter) |
54 | videosRouter.use('/', videoCommentRouter) | 54 | videosRouter.use('/', videoCommentRouter) |
55 | videosRouter.use('/', editorRouter) | 55 | videosRouter.use('/', studioRouter) |
56 | videosRouter.use('/', videoCaptionsRouter) | 56 | videosRouter.use('/', videoCaptionsRouter) |
57 | videosRouter.use('/', videoImportsRouter) | 57 | videosRouter.use('/', videoImportsRouter) |
58 | videosRouter.use('/', ownershipVideoRouter) | 58 | videosRouter.use('/', ownershipVideoRouter) |
diff --git a/server/controllers/api/videos/editor.ts b/server/controllers/api/videos/studio.ts index 588cc1a8c..bff344f3f 100644 --- a/server/controllers/api/videos/editor.ts +++ b/server/controllers/api/videos/studio.ts | |||
@@ -2,26 +2,26 @@ import express from 'express' | |||
2 | import { createAnyReqFiles } from '@server/helpers/express-utils' | 2 | import { createAnyReqFiles } from '@server/helpers/express-utils' |
3 | import { MIMETYPES } from '@server/initializers/constants' | 3 | import { MIMETYPES } from '@server/initializers/constants' |
4 | import { JobQueue } from '@server/lib/job-queue' | 4 | import { JobQueue } from '@server/lib/job-queue' |
5 | import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-editor' | 5 | import { buildTaskFileFieldname, getTaskFile } from '@server/lib/video-studio' |
6 | import { | 6 | import { |
7 | HttpStatusCode, | 7 | HttpStatusCode, |
8 | VideoEditionTaskPayload, | 8 | VideoState, |
9 | VideoEditorCreateEdition, | 9 | VideoStudioCreateEdition, |
10 | VideoEditorTask, | 10 | VideoStudioTask, |
11 | VideoEditorTaskCut, | 11 | VideoStudioTaskCut, |
12 | VideoEditorTaskIntro, | 12 | VideoStudioTaskIntro, |
13 | VideoEditorTaskOutro, | 13 | VideoStudioTaskOutro, |
14 | VideoEditorTaskWatermark, | 14 | VideoStudioTaskPayload, |
15 | VideoState | 15 | VideoStudioTaskWatermark |
16 | } from '@shared/models' | 16 | } from '@shared/models' |
17 | import { asyncMiddleware, authenticate, videosEditorAddEditionValidator } from '../../../middlewares' | 17 | import { asyncMiddleware, authenticate, videoStudioAddEditionValidator } from '../../../middlewares' |
18 | 18 | ||
19 | const editorRouter = express.Router() | 19 | const studioRouter = express.Router() |
20 | 20 | ||
21 | const tasksFiles = createAnyReqFiles( | 21 | const tasksFiles = createAnyReqFiles( |
22 | MIMETYPES.VIDEO.MIMETYPE_EXT, | 22 | MIMETYPES.VIDEO.MIMETYPE_EXT, |
23 | (req: express.Request, file: Express.Multer.File, cb: (err: Error, result?: boolean) => void) => { | 23 | (req: express.Request, file: Express.Multer.File, cb: (err: Error, result?: boolean) => void) => { |
24 | const body = req.body as VideoEditorCreateEdition | 24 | const body = req.body as VideoStudioCreateEdition |
25 | 25 | ||
26 | // Fetch array element | 26 | // Fetch array element |
27 | const matches = file.fieldname.match(/tasks\[(\d+)\]/) | 27 | const matches = file.fieldname.match(/tasks\[(\d+)\]/) |
@@ -43,24 +43,24 @@ const tasksFiles = createAnyReqFiles( | |||
43 | } | 43 | } |
44 | ) | 44 | ) |
45 | 45 | ||
46 | editorRouter.post('/:videoId/editor/edit', | 46 | studioRouter.post('/:videoId/studio/edit', |
47 | authenticate, | 47 | authenticate, |
48 | tasksFiles, | 48 | tasksFiles, |
49 | asyncMiddleware(videosEditorAddEditionValidator), | 49 | asyncMiddleware(videoStudioAddEditionValidator), |
50 | asyncMiddleware(createEditionTasks) | 50 | asyncMiddleware(createEditionTasks) |
51 | ) | 51 | ) |
52 | 52 | ||
53 | // --------------------------------------------------------------------------- | 53 | // --------------------------------------------------------------------------- |
54 | 54 | ||
55 | export { | 55 | export { |
56 | editorRouter | 56 | studioRouter |
57 | } | 57 | } |
58 | 58 | ||
59 | // --------------------------------------------------------------------------- | 59 | // --------------------------------------------------------------------------- |
60 | 60 | ||
61 | async function createEditionTasks (req: express.Request, res: express.Response) { | 61 | async function createEditionTasks (req: express.Request, res: express.Response) { |
62 | const files = req.files as Express.Multer.File[] | 62 | const files = req.files as Express.Multer.File[] |
63 | const body = req.body as VideoEditorCreateEdition | 63 | const body = req.body as VideoStudioCreateEdition |
64 | const video = res.locals.videoAll | 64 | const video = res.locals.videoAll |
65 | 65 | ||
66 | video.state = VideoState.TO_EDIT | 66 | video.state = VideoState.TO_EDIT |
@@ -71,13 +71,13 @@ async function createEditionTasks (req: express.Request, res: express.Response) | |||
71 | tasks: body.tasks.map((t, i) => buildTaskPayload(t, i, files)) | 71 | tasks: body.tasks.map((t, i) => buildTaskPayload(t, i, files)) |
72 | } | 72 | } |
73 | 73 | ||
74 | JobQueue.Instance.createJob({ type: 'video-edition', payload }) | 74 | JobQueue.Instance.createJob({ type: 'video-studio-edition', payload }) |
75 | 75 | ||
76 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) | 76 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
77 | } | 77 | } |
78 | 78 | ||
79 | const taskPayloadBuilders: { | 79 | const taskPayloadBuilders: { |
80 | [id in VideoEditorTask['name']]: (task: VideoEditorTask, indice?: number, files?: Express.Multer.File[]) => VideoEditionTaskPayload | 80 | [id in VideoStudioTask['name']]: (task: VideoStudioTask, indice?: number, files?: Express.Multer.File[]) => VideoStudioTaskPayload |
81 | } = { | 81 | } = { |
82 | 'add-intro': buildIntroOutroTask, | 82 | 'add-intro': buildIntroOutroTask, |
83 | 'add-outro': buildIntroOutroTask, | 83 | 'add-outro': buildIntroOutroTask, |
@@ -85,11 +85,11 @@ const taskPayloadBuilders: { | |||
85 | 'add-watermark': buildWatermarkTask | 85 | 'add-watermark': buildWatermarkTask |
86 | } | 86 | } |
87 | 87 | ||
88 | function buildTaskPayload (task: VideoEditorTask, indice: number, files: Express.Multer.File[]): VideoEditionTaskPayload { | 88 | function buildTaskPayload (task: VideoStudioTask, indice: number, files: Express.Multer.File[]): VideoStudioTaskPayload { |
89 | return taskPayloadBuilders[task.name](task, indice, files) | 89 | return taskPayloadBuilders[task.name](task, indice, files) |
90 | } | 90 | } |
91 | 91 | ||
92 | function buildIntroOutroTask (task: VideoEditorTaskIntro | VideoEditorTaskOutro, indice: number, files: Express.Multer.File[]) { | 92 | function buildIntroOutroTask (task: VideoStudioTaskIntro | VideoStudioTaskOutro, indice: number, files: Express.Multer.File[]) { |
93 | return { | 93 | return { |
94 | name: task.name, | 94 | name: task.name, |
95 | options: { | 95 | options: { |
@@ -98,7 +98,7 @@ function buildIntroOutroTask (task: VideoEditorTaskIntro | VideoEditorTaskOutro, | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | function buildCutTask (task: VideoEditorTaskCut) { | 101 | function buildCutTask (task: VideoStudioTaskCut) { |
102 | return { | 102 | return { |
103 | name: task.name, | 103 | name: task.name, |
104 | options: { | 104 | options: { |
@@ -108,7 +108,7 @@ function buildCutTask (task: VideoEditorTaskCut) { | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | function buildWatermarkTask (task: VideoEditorTaskWatermark, indice: number, files: Express.Multer.File[]) { | 111 | function buildWatermarkTask (task: VideoStudioTaskWatermark, indice: number, files: Express.Multer.File[]) { |
112 | return { | 112 | return { |
113 | name: task.name, | 113 | name: task.name, |
114 | options: { | 114 | options: { |