aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-18 14:35:08 +0100
committerChocobozzz <me@florianbigard.com>2021-11-18 15:20:57 +0100
commitad5db1044c8599eaaaa2a578b350777ae996b068 (patch)
tree3e003cccf021152405d49b21c6c91b703c8ae96c /shared/extra-utils
parentb46cf4b920984492df598c1b61179acfc7f6f22e (diff)
downloadPeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.gz
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.zst
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.zip
Add ability to run transcoding jobs
Diffstat (limited to 'shared/extra-utils')
-rw-r--r--shared/extra-utils/server/jobs-command.ts15
-rw-r--r--shared/extra-utils/videos/videos-command.ts21
2 files changed, 35 insertions, 1 deletions
diff --git a/shared/extra-utils/server/jobs-command.ts b/shared/extra-utils/server/jobs-command.ts
index f28397816..6636e7e4d 100644
--- a/shared/extra-utils/server/jobs-command.ts
+++ b/shared/extra-utils/server/jobs-command.ts
@@ -36,6 +36,21 @@ export class JobsCommand extends AbstractCommand {
36 }) 36 })
37 } 37 }
38 38
39 listFailed (options: OverrideCommandOptions & {
40 jobType?: JobType
41 }) {
42 const path = this.buildJobsUrl('failed')
43
44 return this.getRequestBody<ResultList<Job>>({
45 ...options,
46
47 path,
48 query: { start: 0, count: 50 },
49 implicitToken: true,
50 defaultExpectedStatus: HttpStatusCode.OK_200
51 })
52 }
53
39 private buildJobsUrl (state?: JobState) { 54 private buildJobsUrl (state?: JobState) {
40 let path = '/api/v1/jobs' 55 let path = '/api/v1/jobs'
41 56
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts
index 13a7d0e1c..7ec9c3647 100644
--- a/shared/extra-utils/videos/videos-command.ts
+++ b/shared/extra-utils/videos/videos-command.ts
@@ -18,7 +18,8 @@ import {
18 VideoDetails, 18 VideoDetails,
19 VideoFileMetadata, 19 VideoFileMetadata,
20 VideoPrivacy, 20 VideoPrivacy,
21 VideosCommonQuery 21 VideosCommonQuery,
22 VideoTranscodingCreate
22} from '@shared/models' 23} from '@shared/models'
23import { buildAbsoluteFixturePath, wait } from '../miscs' 24import { buildAbsoluteFixturePath, wait } from '../miscs'
24import { unwrapBody } from '../requests' 25import { unwrapBody } from '../requests'
@@ -630,6 +631,24 @@ export class VideosCommand extends AbstractCommand {
630 }) 631 })
631 } 632 }
632 633
634 runTranscoding (options: OverrideCommandOptions & {
635 videoId: number | string
636 transcodingType: 'hls' | 'webtorrent'
637 }) {
638 const path = '/api/v1/videos/' + options.videoId + '/transcoding'
639
640 const fields: VideoTranscodingCreate = pick(options, [ 'transcodingType' ])
641
642 return this.postBodyRequest({
643 ...options,
644
645 path,
646 fields,
647 implicitToken: true,
648 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
649 })
650 }
651
633 // --------------------------------------------------------------------------- 652 // ---------------------------------------------------------------------------
634 653
635 private buildListQuery (options: VideosCommonQuery) { 654 private buildListQuery (options: VideosCommonQuery) {