diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-04 15:29:34 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | 5e47f6ab984a7d00782e4c7030afffa1ba480add (patch) | |
tree | 1ce586b591a8d71acbc301eba29b9a5e6490439e /server/controllers/api/runners/jobs-files.ts | |
parent | 6a4905602636afd6650c9e6f4d0fcc2105d91100 (diff) | |
download | PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.tar.gz PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.tar.zst PeerTube-5e47f6ab984a7d00782e4c7030afffa1ba480add.zip |
Support studio transcoding in peertube runner
Diffstat (limited to 'server/controllers/api/runners/jobs-files.ts')
-rw-r--r-- | server/controllers/api/runners/jobs-files.ts | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/server/controllers/api/runners/jobs-files.ts b/server/controllers/api/runners/jobs-files.ts index e43ce35f5..4efa40b3a 100644 --- a/server/controllers/api/runners/jobs-files.ts +++ b/server/controllers/api/runners/jobs-files.ts | |||
@@ -2,9 +2,13 @@ import express from 'express' | |||
2 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 2 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
3 | import { proxifyHLS, proxifyWebTorrentFile } from '@server/lib/object-storage' | 3 | import { proxifyHLS, proxifyWebTorrentFile } from '@server/lib/object-storage' |
4 | import { VideoPathManager } from '@server/lib/video-path-manager' | 4 | import { VideoPathManager } from '@server/lib/video-path-manager' |
5 | import { getStudioTaskFilePath } from '@server/lib/video-studio' | ||
5 | import { asyncMiddleware } from '@server/middlewares' | 6 | import { asyncMiddleware } from '@server/middlewares' |
6 | import { jobOfRunnerGetValidator } from '@server/middlewares/validators/runners' | 7 | import { jobOfRunnerGetValidator } from '@server/middlewares/validators/runners' |
7 | import { runnerJobGetVideoTranscodingFileValidator } from '@server/middlewares/validators/runners/job-files' | 8 | import { |
9 | runnerJobGetVideoStudioTaskFileValidator, | ||
10 | runnerJobGetVideoTranscodingFileValidator | ||
11 | } from '@server/middlewares/validators/runners/job-files' | ||
8 | import { VideoStorage } from '@shared/models' | 12 | import { VideoStorage } from '@shared/models' |
9 | 13 | ||
10 | const lTags = loggerTagsFactory('api', 'runner') | 14 | const lTags = loggerTagsFactory('api', 'runner') |
@@ -23,6 +27,13 @@ runnerJobFilesRouter.post('/jobs/:jobUUID/files/videos/:videoId/previews/max-qua | |||
23 | getMaxQualityVideoPreview | 27 | getMaxQualityVideoPreview |
24 | ) | 28 | ) |
25 | 29 | ||
30 | runnerJobFilesRouter.post('/jobs/:jobUUID/files/videos/:videoId/studio/task-files/:filename', | ||
31 | asyncMiddleware(jobOfRunnerGetValidator), | ||
32 | asyncMiddleware(runnerJobGetVideoTranscodingFileValidator), | ||
33 | runnerJobGetVideoStudioTaskFileValidator, | ||
34 | getVideoEditionTaskFile | ||
35 | ) | ||
36 | |||
26 | // --------------------------------------------------------------------------- | 37 | // --------------------------------------------------------------------------- |
27 | 38 | ||
28 | export { | 39 | export { |
@@ -82,3 +93,17 @@ function getMaxQualityVideoPreview (req: express.Request, res: express.Response) | |||
82 | 93 | ||
83 | return res.sendFile(file.getPath()) | 94 | return res.sendFile(file.getPath()) |
84 | } | 95 | } |
96 | |||
97 | function getVideoEditionTaskFile (req: express.Request, res: express.Response) { | ||
98 | const runnerJob = res.locals.runnerJob | ||
99 | const runner = runnerJob.Runner | ||
100 | const video = res.locals.videoAll | ||
101 | const filename = req.params.filename | ||
102 | |||
103 | logger.info( | ||
104 | 'Get video edition task file %s of video %s of job %s for runner %s', filename, video.uuid, runnerJob.uuid, runner.name, | ||
105 | lTags(runner.name, runnerJob.id, runnerJob.type) | ||
106 | ) | ||
107 | |||
108 | return res.sendFile(getStudioTaskFilePath(filename)) | ||
109 | } | ||