@osaas/cli 0.10.2 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +11 -9
- package/dist/cli.js.map +1 -1
- package/dist/transcode/cmd.d.ts +3 -1
- package/dist/transcode/cmd.d.ts.map +1 -1
- package/dist/transcode/cmd.js +124 -3
- package/dist/transcode/cmd.js.map +1 -1
- package/package.json +6 -6
- package/readme.md +7 -0
- package/src/cli.ts +4 -2
- package/src/transcode/cmd.ts +142 -4
package/dist/cli.js
CHANGED
|
@@ -32,13 +32,13 @@ const path_1 = require("path");
|
|
|
32
32
|
const commander_1 = require("commander");
|
|
33
33
|
const cmd_1 = __importDefault(require("./admin/cmd"));
|
|
34
34
|
const cmdUser = __importStar(require("./user/cmd"));
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
35
|
+
const cmdTranscode = __importStar(require("./transcode/cmd"));
|
|
36
|
+
const cmd_2 = __importDefault(require("./vmaf/cmd"));
|
|
37
|
+
const cmd_3 = __importDefault(require("./packager/cmd"));
|
|
38
|
+
const cmd_4 = __importDefault(require("./live/cmd"));
|
|
39
|
+
const cmd_5 = __importDefault(require("./intercom/cmd"));
|
|
40
|
+
const cmd_6 = __importDefault(require("./transcribe/cmd"));
|
|
41
|
+
const cmd_7 = __importDefault(require("./db/cmd"));
|
|
42
42
|
const cli = new commander_1.Command();
|
|
43
43
|
// Read package.json
|
|
44
44
|
const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
|
|
@@ -50,12 +50,14 @@ cli.addCommand((0, cmd_1.default)());
|
|
|
50
50
|
cli.addCommand(cmdUser.cmdList());
|
|
51
51
|
cli.addCommand(cmdUser.cmdCreate());
|
|
52
52
|
cli.addCommand(cmdUser.cmdRemove());
|
|
53
|
+
cli.addCommand(cmdTranscode.cmdTranscode());
|
|
54
|
+
cli.addCommand(cmdTranscode.cmdEncore());
|
|
55
|
+
cli.addCommand(cmdTranscode.cmdVodPipeline());
|
|
56
|
+
cli.addCommand((0, cmd_3.default)());
|
|
53
57
|
cli.addCommand((0, cmd_2.default)());
|
|
54
58
|
cli.addCommand((0, cmd_4.default)());
|
|
55
|
-
cli.addCommand((0, cmd_3.default)());
|
|
56
59
|
cli.addCommand((0, cmd_5.default)());
|
|
57
60
|
cli.addCommand((0, cmd_6.default)());
|
|
58
61
|
cli.addCommand((0, cmd_7.default)());
|
|
59
|
-
cli.addCommand((0, cmd_8.default)());
|
|
60
62
|
cli.parse(process.argv);
|
|
61
63
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2BAAkC;AAClC,+BAA4B;AAC5B,yCAAoC;AACpC,sDAAmC;AACnC,oDAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2BAAkC;AAClC,+BAA4B;AAC5B,yCAAoC;AACpC,sDAAmC;AACnC,oDAAsC;AACtC,8DAAgD;AAChD,qDAAoC;AACpC,yDAAyC;AACzC,qDAAiC;AACjC,yDAAyC;AACzC,2DAA6C;AAC7C,mDAA6B;AAE7B,MAAM,GAAG,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE1B,oBAAoB;AACpB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC5D,CAAC;AAEF,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,4BAA4B,CAAC,CAAC;AAEhF,GAAG;KACA,aAAa,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAC;AAEvD,GAAG,CAAC,UAAU,CAAC,IAAA,aAAQ,GAAE,CAAC,CAAC;AAC3B,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAClC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AACpC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AACpC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC;AAC5C,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;AACzC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC;AAC9C,GAAG,CAAC,UAAU,CAAC,IAAA,aAAW,GAAE,CAAC,CAAC;AAC9B,GAAG,CAAC,UAAU,CAAC,IAAA,aAAU,GAAE,CAAC,CAAC;AAC7B,GAAG,CAAC,UAAU,CAAC,IAAA,aAAO,GAAE,CAAC,CAAC;AAC1B,GAAG,CAAC,UAAU,CAAC,IAAA,aAAW,GAAE,CAAC,CAAC;AAC9B,GAAG,CAAC,UAAU,CAAC,IAAA,aAAa,GAAE,CAAC,CAAC;AAChC,GAAG,CAAC,UAAU,CAAC,IAAA,aAAK,GAAE,CAAC,CAAC;AACxB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/transcode/cmd.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
export
|
|
2
|
+
export declare function cmdTranscode(): Command;
|
|
3
|
+
export declare function cmdVodPipeline(): Command;
|
|
4
|
+
export declare function cmdEncore(): Command;
|
|
3
5
|
//# sourceMappingURL=cmd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/transcode/cmd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/transcode/cmd.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,wBAAgB,YAAY,YA4C3B;AAED,wBAAgB,cAAc,YAiF7B;AAED,wBAAgB,SAAS,YAqCxB"}
|
package/dist/transcode/cmd.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cmdEncore = exports.cmdVodPipeline = exports.cmdTranscode = void 0;
|
|
3
4
|
const client_core_1 = require("@osaas/client-core");
|
|
4
5
|
const client_transcode_1 = require("@osaas/client-transcode");
|
|
5
6
|
const commander_1 = require("commander");
|
|
@@ -11,18 +12,28 @@ function cmdTranscode() {
|
|
|
11
12
|
.argument('<dest>', 'Destination URL (supported protocols: s3)')
|
|
12
13
|
.argument('[packageDestination]', 'Optional destination URL for Streaming package (supported protocols: s3)')
|
|
13
14
|
.option('-d, --duration <duration>', 'Duration in seconds. If not provided will transcode entire file')
|
|
15
|
+
.option('-b, --background', 'Run transcoding and packaging in background')
|
|
14
16
|
.action(async (source, dest, packageDestination, options, command) => {
|
|
15
17
|
try {
|
|
18
|
+
if (options.background) {
|
|
19
|
+
throw new Error(`Option '-b' has been deprecated and replaced with 'osc pipeline' command.`);
|
|
20
|
+
}
|
|
16
21
|
const globalOpts = command.optsWithGlobals();
|
|
17
22
|
const environment = globalOpts?.env || 'prod';
|
|
18
23
|
const ctx = new client_core_1.Context({ environment });
|
|
19
|
-
const pool = new client_transcode_1.QueuePool({
|
|
24
|
+
const pool = new client_transcode_1.QueuePool({
|
|
25
|
+
context: ctx,
|
|
26
|
+
size: 1,
|
|
27
|
+
usePackagingQueue: options.background
|
|
28
|
+
});
|
|
20
29
|
await pool.init();
|
|
21
30
|
await pool.transcode(new URL(source), new URL(dest), {
|
|
22
31
|
duration: options.duration,
|
|
23
32
|
packageDestination: packageDestination
|
|
24
33
|
});
|
|
25
|
-
|
|
34
|
+
if (!options.background) {
|
|
35
|
+
await pool.destroy();
|
|
36
|
+
}
|
|
26
37
|
}
|
|
27
38
|
catch (err) {
|
|
28
39
|
console.log(err.message);
|
|
@@ -30,5 +41,115 @@ function cmdTranscode() {
|
|
|
30
41
|
});
|
|
31
42
|
return transcode;
|
|
32
43
|
}
|
|
33
|
-
exports.
|
|
44
|
+
exports.cmdTranscode = cmdTranscode;
|
|
45
|
+
function cmdVodPipeline() {
|
|
46
|
+
const pipeline = new commander_1.Command('pipeline');
|
|
47
|
+
pipeline
|
|
48
|
+
.command('create')
|
|
49
|
+
.description('Create a new VOD pipeline')
|
|
50
|
+
.argument('<dest>', 'Destination URL (supported protocols: s3)')
|
|
51
|
+
.option('-s, --size <size>', 'Number of Encore instances in the pool (default: 1)')
|
|
52
|
+
.action(async (dest, options, command) => {
|
|
53
|
+
try {
|
|
54
|
+
const globalOpts = command.optsWithGlobals();
|
|
55
|
+
const environment = globalOpts?.env || 'prod';
|
|
56
|
+
const ctx = new client_core_1.Context({ environment });
|
|
57
|
+
const pool = new client_transcode_1.QueuePool({
|
|
58
|
+
context: ctx,
|
|
59
|
+
size: options.size || 1,
|
|
60
|
+
usePackagingQueue: true,
|
|
61
|
+
packageDestination: new URL(dest)
|
|
62
|
+
});
|
|
63
|
+
await pool.destroy(); // Remove pipeline if already exists
|
|
64
|
+
await pool.init();
|
|
65
|
+
console.log('VOD pipeline created');
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
console.log(err.message);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
pipeline
|
|
72
|
+
.command('transcode')
|
|
73
|
+
.description('Transcode and create VOD package')
|
|
74
|
+
.argument('<source>', 'Source URL (supported protocols: http, https)')
|
|
75
|
+
.option('-d, --duration <duration>', 'Duration in seconds. If not provided will transcode entire file')
|
|
76
|
+
.action(async (source, options, command) => {
|
|
77
|
+
try {
|
|
78
|
+
const globalOpts = command.optsWithGlobals();
|
|
79
|
+
const environment = globalOpts?.env || 'prod';
|
|
80
|
+
const ctx = new client_core_1.Context({ environment });
|
|
81
|
+
const pool = new client_transcode_1.QueuePool({
|
|
82
|
+
context: ctx,
|
|
83
|
+
size: options.size || 1,
|
|
84
|
+
usePackagingQueue: true
|
|
85
|
+
});
|
|
86
|
+
await pool.init();
|
|
87
|
+
await pool.transcode(new URL(source), new URL('s3://dummy/'), {
|
|
88
|
+
duration: options.duration
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
console.log(err.message);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
pipeline
|
|
96
|
+
.command('teardown')
|
|
97
|
+
.description('Tear down the VOD pipeline')
|
|
98
|
+
.option('-s, --size <size>', 'Number of Encore instances in the pool (default: 1)')
|
|
99
|
+
.action(async (options, command) => {
|
|
100
|
+
try {
|
|
101
|
+
const globalOpts = command.optsWithGlobals();
|
|
102
|
+
const environment = globalOpts?.env || 'prod';
|
|
103
|
+
const ctx = new client_core_1.Context({ environment });
|
|
104
|
+
const pool = new client_transcode_1.QueuePool({
|
|
105
|
+
context: ctx,
|
|
106
|
+
size: options.size || 1,
|
|
107
|
+
usePackagingQueue: true
|
|
108
|
+
});
|
|
109
|
+
await pool.init();
|
|
110
|
+
await pool.destroy();
|
|
111
|
+
console.log('VOD pipeline torn down');
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
console.log(err.message);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return pipeline;
|
|
118
|
+
}
|
|
119
|
+
exports.cmdVodPipeline = cmdVodPipeline;
|
|
120
|
+
function cmdEncore() {
|
|
121
|
+
const encore = new commander_1.Command('encore');
|
|
122
|
+
encore
|
|
123
|
+
.command('list-callbacks')
|
|
124
|
+
.description('List all callback listeners')
|
|
125
|
+
.action(async (options, command) => {
|
|
126
|
+
try {
|
|
127
|
+
const globalOpts = command.optsWithGlobals();
|
|
128
|
+
const environment = globalOpts?.env || 'prod';
|
|
129
|
+
const ctx = new client_core_1.Context({ environment });
|
|
130
|
+
const callbacks = await client_transcode_1.EncoreCallbackListener.list(ctx);
|
|
131
|
+
callbacks.map((callback) => console.log(callback.getName()));
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
console.log(err.message);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
encore
|
|
138
|
+
.command('list-packagers')
|
|
139
|
+
.description('List all packagers')
|
|
140
|
+
.action(async (options, command) => {
|
|
141
|
+
try {
|
|
142
|
+
const globalOpts = command.optsWithGlobals();
|
|
143
|
+
const environment = globalOpts?.env || 'prod';
|
|
144
|
+
const ctx = new client_core_1.Context({ environment });
|
|
145
|
+
const packagers = await client_transcode_1.EncorePackager.list(ctx);
|
|
146
|
+
packagers.map((packager) => console.log(packager.getName() + ': ' + packager.getOutputFolder()));
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
console.log(err.message);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return encore;
|
|
153
|
+
}
|
|
154
|
+
exports.cmdEncore = cmdEncore;
|
|
34
155
|
//# sourceMappingURL=cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/transcode/cmd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/transcode/cmd.ts"],"names":[],"mappings":";;;AAAA,oDAA6C;AAC7C,8DAIiC;AACjC,yCAAoC;AAEpC,SAAgB,YAAY;IAC1B,MAAM,SAAS,GAAG,IAAI,mBAAO,CAAC,WAAW,CA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;SACjC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACjC,IAAI;YACF,MAAM,UAAU,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,WAAW,GAAG,UAAU,EAAE,GAAG,IAAI,MAAM,CAAC;YAC9C,MAAM,GAAG,GAAG,IAAI,qBAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YACzC,MAAM,SAAS,GAAG,MAAM,iCAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjD,SAAS,CAAC,GAAG,CAAC,CAAC,QAAwB,EAAE,EAAE,CACzC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC,CACpE,CAAC;SACH;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,MAAM,CAAC;AAChB,CAAC;AArCD,8BAqCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osaas/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Open Source Cloud CLI",
|
|
5
5
|
"author": "Eyevinn Technology <work@eyevinn.se>",
|
|
6
6
|
"homepage": "https://www.osaas.io",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"test": "jest --pass-with-no-tests"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@osaas/client-core": "^0.
|
|
25
|
-
"@osaas/client-db": "^0.
|
|
26
|
-
"@osaas/client-intercom": "^0.1.
|
|
27
|
-
"@osaas/client-transcode": "^0.
|
|
24
|
+
"@osaas/client-core": "^0.9.0",
|
|
25
|
+
"@osaas/client-db": "^0.2.0",
|
|
26
|
+
"@osaas/client-intercom": "^0.1.1",
|
|
27
|
+
"@osaas/client-transcode": "^0.8.1",
|
|
28
28
|
"chalk": "4.1.2",
|
|
29
29
|
"commander": "^12.1.0",
|
|
30
30
|
"fast-jwt": "^4.0.1"
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "d034026b1ff8aeb3e3f1e3ac9298b95241695123"
|
|
36
36
|
}
|
package/readme.md
CHANGED
|
@@ -85,6 +85,13 @@ osc transcode \
|
|
|
85
85
|
s3://lab-testcontent-store/birme/
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
### Transcode and create streaming package using SVT Encore and Shaka Packager
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
osc pipeline create s3://lab-testcontent-store/birme/output/
|
|
92
|
+
osc pipeline transcode https://testcontent.eyevinn.technology/mp4/stswe-tvplus-promo.mp4
|
|
93
|
+
```
|
|
94
|
+
|
|
88
95
|
### Compare two video files using VMAF
|
|
89
96
|
|
|
90
97
|
```
|
package/src/cli.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { join } from 'path';
|
|
|
5
5
|
import { Command } from 'commander';
|
|
6
6
|
import cmdAdmin from './admin/cmd';
|
|
7
7
|
import * as cmdUser from './user/cmd';
|
|
8
|
-
import cmdTranscode from './transcode/cmd';
|
|
8
|
+
import * as cmdTranscode from './transcode/cmd';
|
|
9
9
|
import cmdCompare from './vmaf/cmd';
|
|
10
10
|
import cmdPackager from './packager/cmd';
|
|
11
11
|
import cmdLive from './live/cmd';
|
|
@@ -30,7 +30,9 @@ cli.addCommand(cmdAdmin());
|
|
|
30
30
|
cli.addCommand(cmdUser.cmdList());
|
|
31
31
|
cli.addCommand(cmdUser.cmdCreate());
|
|
32
32
|
cli.addCommand(cmdUser.cmdRemove());
|
|
33
|
-
cli.addCommand(cmdTranscode());
|
|
33
|
+
cli.addCommand(cmdTranscode.cmdTranscode());
|
|
34
|
+
cli.addCommand(cmdTranscode.cmdEncore());
|
|
35
|
+
cli.addCommand(cmdTranscode.cmdVodPipeline());
|
|
34
36
|
cli.addCommand(cmdPackager());
|
|
35
37
|
cli.addCommand(cmdCompare());
|
|
36
38
|
cli.addCommand(cmdLive());
|
package/src/transcode/cmd.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Context } from '@osaas/client-core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
EncoreCallbackListener,
|
|
4
|
+
EncorePackager,
|
|
5
|
+
QueuePool
|
|
6
|
+
} from '@osaas/client-transcode';
|
|
3
7
|
import { Command } from 'commander';
|
|
4
8
|
|
|
5
|
-
export
|
|
9
|
+
export function cmdTranscode() {
|
|
6
10
|
const transcode = new Command('transcode');
|
|
7
11
|
|
|
8
12
|
transcode
|
|
@@ -17,21 +21,155 @@ export default function cmdTranscode() {
|
|
|
17
21
|
'-d, --duration <duration>',
|
|
18
22
|
'Duration in seconds. If not provided will transcode entire file'
|
|
19
23
|
)
|
|
24
|
+
.option('-b, --background', 'Run transcoding and packaging in background')
|
|
20
25
|
.action(async (source, dest, packageDestination, options, command) => {
|
|
21
26
|
try {
|
|
27
|
+
if (options.background) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Option '-b' has been deprecated and replaced with 'osc pipeline' command.`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
22
32
|
const globalOpts = command.optsWithGlobals();
|
|
23
33
|
const environment = globalOpts?.env || 'prod';
|
|
24
34
|
const ctx = new Context({ environment });
|
|
25
|
-
const pool = new QueuePool({
|
|
35
|
+
const pool = new QueuePool({
|
|
36
|
+
context: ctx,
|
|
37
|
+
size: 1,
|
|
38
|
+
usePackagingQueue: options.background
|
|
39
|
+
});
|
|
26
40
|
await pool.init();
|
|
27
41
|
await pool.transcode(new URL(source), new URL(dest), {
|
|
28
42
|
duration: options.duration,
|
|
29
43
|
packageDestination: packageDestination
|
|
30
44
|
});
|
|
31
|
-
|
|
45
|
+
if (!options.background) {
|
|
46
|
+
await pool.destroy();
|
|
47
|
+
}
|
|
32
48
|
} catch (err) {
|
|
33
49
|
console.log((err as Error).message);
|
|
34
50
|
}
|
|
35
51
|
});
|
|
36
52
|
return transcode;
|
|
37
53
|
}
|
|
54
|
+
|
|
55
|
+
export function cmdVodPipeline() {
|
|
56
|
+
const pipeline = new Command('pipeline');
|
|
57
|
+
pipeline
|
|
58
|
+
.command('create')
|
|
59
|
+
.description('Create a new VOD pipeline')
|
|
60
|
+
.argument('<dest>', 'Destination URL (supported protocols: s3)')
|
|
61
|
+
.option(
|
|
62
|
+
'-s, --size <size>',
|
|
63
|
+
'Number of Encore instances in the pool (default: 1)'
|
|
64
|
+
)
|
|
65
|
+
.action(async (dest, options, command) => {
|
|
66
|
+
try {
|
|
67
|
+
const globalOpts = command.optsWithGlobals();
|
|
68
|
+
const environment = globalOpts?.env || 'prod';
|
|
69
|
+
const ctx = new Context({ environment });
|
|
70
|
+
const pool = new QueuePool({
|
|
71
|
+
context: ctx,
|
|
72
|
+
size: options.size || 1,
|
|
73
|
+
usePackagingQueue: true,
|
|
74
|
+
packageDestination: new URL(dest)
|
|
75
|
+
});
|
|
76
|
+
await pool.destroy(); // Remove pipeline if already exists
|
|
77
|
+
await pool.init();
|
|
78
|
+
console.log('VOD pipeline created');
|
|
79
|
+
} catch (err) {
|
|
80
|
+
console.log((err as Error).message);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
pipeline
|
|
85
|
+
.command('transcode')
|
|
86
|
+
.description('Transcode and create VOD package')
|
|
87
|
+
.argument('<source>', 'Source URL (supported protocols: http, https)')
|
|
88
|
+
.option(
|
|
89
|
+
'-d, --duration <duration>',
|
|
90
|
+
'Duration in seconds. If not provided will transcode entire file'
|
|
91
|
+
)
|
|
92
|
+
.action(async (source, options, command) => {
|
|
93
|
+
try {
|
|
94
|
+
const globalOpts = command.optsWithGlobals();
|
|
95
|
+
const environment = globalOpts?.env || 'prod';
|
|
96
|
+
const ctx = new Context({ environment });
|
|
97
|
+
const pool = new QueuePool({
|
|
98
|
+
context: ctx,
|
|
99
|
+
size: options.size || 1,
|
|
100
|
+
usePackagingQueue: true
|
|
101
|
+
});
|
|
102
|
+
await pool.init();
|
|
103
|
+
await pool.transcode(new URL(source), new URL('s3://dummy/'), {
|
|
104
|
+
duration: options.duration
|
|
105
|
+
});
|
|
106
|
+
} catch (err) {
|
|
107
|
+
console.log((err as Error).message);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
pipeline
|
|
112
|
+
.command('teardown')
|
|
113
|
+
.description('Tear down the VOD pipeline')
|
|
114
|
+
.option(
|
|
115
|
+
'-s, --size <size>',
|
|
116
|
+
'Number of Encore instances in the pool (default: 1)'
|
|
117
|
+
)
|
|
118
|
+
.action(async (options, command) => {
|
|
119
|
+
try {
|
|
120
|
+
const globalOpts = command.optsWithGlobals();
|
|
121
|
+
const environment = globalOpts?.env || 'prod';
|
|
122
|
+
const ctx = new Context({ environment });
|
|
123
|
+
const pool = new QueuePool({
|
|
124
|
+
context: ctx,
|
|
125
|
+
size: options.size || 1,
|
|
126
|
+
usePackagingQueue: true
|
|
127
|
+
});
|
|
128
|
+
await pool.init();
|
|
129
|
+
await pool.destroy();
|
|
130
|
+
console.log('VOD pipeline torn down');
|
|
131
|
+
} catch (err) {
|
|
132
|
+
console.log((err as Error).message);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return pipeline;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function cmdEncore() {
|
|
139
|
+
const encore = new Command('encore');
|
|
140
|
+
encore
|
|
141
|
+
.command('list-callbacks')
|
|
142
|
+
.description('List all callback listeners')
|
|
143
|
+
.action(async (options, command) => {
|
|
144
|
+
try {
|
|
145
|
+
const globalOpts = command.optsWithGlobals();
|
|
146
|
+
const environment = globalOpts?.env || 'prod';
|
|
147
|
+
const ctx = new Context({ environment });
|
|
148
|
+
const callbacks = await EncoreCallbackListener.list(ctx);
|
|
149
|
+
callbacks.map((callback: EncoreCallbackListener) =>
|
|
150
|
+
console.log(callback.getName())
|
|
151
|
+
);
|
|
152
|
+
} catch (err) {
|
|
153
|
+
console.log((err as Error).message);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
encore
|
|
158
|
+
.command('list-packagers')
|
|
159
|
+
.description('List all packagers')
|
|
160
|
+
.action(async (options, command) => {
|
|
161
|
+
try {
|
|
162
|
+
const globalOpts = command.optsWithGlobals();
|
|
163
|
+
const environment = globalOpts?.env || 'prod';
|
|
164
|
+
const ctx = new Context({ environment });
|
|
165
|
+
const packagers = await EncorePackager.list(ctx);
|
|
166
|
+
packagers.map((packager: EncorePackager) =>
|
|
167
|
+
console.log(packager.getName() + ': ' + packager.getOutputFolder())
|
|
168
|
+
);
|
|
169
|
+
} catch (err) {
|
|
170
|
+
console.log((err as Error).message);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
return encore;
|
|
175
|
+
}
|