@osaas/cli 0.8.0 → 0.9.0

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 CHANGED
@@ -35,6 +35,7 @@ const cmd_3 = __importDefault(require("./vmaf/cmd"));
35
35
  const cmd_4 = __importDefault(require("./packager/cmd"));
36
36
  const cmd_5 = __importDefault(require("./live/cmd"));
37
37
  const cmd_6 = __importDefault(require("./intercom/cmd"));
38
+ const cmd_7 = __importDefault(require("./transcribe/cmd"));
38
39
  const cli = new commander_1.Command();
39
40
  cli
40
41
  .configureHelp({ showGlobalOptions: true })
@@ -48,5 +49,6 @@ cli.addCommand((0, cmd_4.default)());
48
49
  cli.addCommand((0, cmd_3.default)());
49
50
  cli.addCommand((0, cmd_5.default)());
50
51
  cli.addCommand((0, cmd_6.default)());
52
+ cli.addCommand((0, cmd_7.default)());
51
53
  cli.parse(process.argv);
52
54
  //# 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,yCAAoC;AACpC,sDAAmC;AACnC,oDAAsC;AACtC,0DAA2C;AAC3C,qDAAoC;AACpC,yDAAyC;AACzC,qDAAiC;AACjC,yDAAyC;AAEzC,MAAM,GAAG,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE1B,GAAG;KACA,aAAa,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAC;AACvD,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,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,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,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export default function cmdTranscribe(): Command;
3
+ //# sourceMappingURL=cmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/transcribe/cmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,OAAO,UAAU,aAAa,YA6BpC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const client_core_1 = require("@osaas/client-core");
4
+ const client_transcode_1 = require("@osaas/client-transcode");
5
+ const commander_1 = require("commander");
6
+ function cmdTranscribe() {
7
+ const transcriber = new commander_1.Command('transcribe');
8
+ transcriber
9
+ .description('Generate subtitles from video or audio using Open AI Whisper')
10
+ .argument('<source>', 'Source URL (supported protocols: http, https)')
11
+ .option('-f, --format', 'Output format (default: vtt)')
12
+ .option('-l, --language', 'Language (default: en)')
13
+ .action(async (source, options, command) => {
14
+ try {
15
+ const globalOpts = command.optsWithGlobals();
16
+ const environment = globalOpts?.env || 'prod';
17
+ const ctx = new client_core_1.Context({ environment });
18
+ const format = options.format || 'vtt';
19
+ const language = options.language || 'en';
20
+ const pool = new client_transcode_1.SubtitlingPool({ context: ctx, size: 1 });
21
+ if (!process.env.OPENAI_API_KEY) {
22
+ throw new Error('Environment variable OPENAI_API_KEY not set');
23
+ }
24
+ await pool.init({
25
+ openaikey: process.env.OPENAI_API_KEY
26
+ });
27
+ const result = await pool.transcribe(new URL(source), language, format);
28
+ console.log(result);
29
+ }
30
+ catch (err) {
31
+ console.log(err.message);
32
+ }
33
+ });
34
+ return transcriber;
35
+ }
36
+ exports.default = cmdTranscribe;
37
+ //# sourceMappingURL=cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/transcribe/cmd.ts"],"names":[],"mappings":";;AAAA,oDAA6C;AAC7C,8DAAyD;AACzD,yCAAoC;AAEpC,SAAwB,aAAa;IACnC,MAAM,WAAW,GAAG,IAAI,mBAAO,CAAC,YAAY,CAAC,CAAC;IAE9C,WAAW;SACR,WAAW,CAAC,8DAA8D,CAAC;SAC3E,QAAQ,CAAC,UAAU,EAAE,+CAA+C,CAAC;SACrE,MAAM,CAAC,cAAc,EAAE,8BAA8B,CAAC;SACtD,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;SAClD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACzC,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,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;YACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;YAC1C,MAAM,IAAI,GAAG,IAAI,iCAAc,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAChE;YACD,MAAM,IAAI,CAAC,IAAI,CAAC;gBACd,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;aACtC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SACrB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IACL,OAAO,WAAW,CAAC;AACrB,CAAC;AA7BD,gCA6BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osaas/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Open Source Cloud CLI",
5
5
  "author": "Eyevinn Technology <work@eyevinn.se>",
6
6
  "homepage": "https://www.osaas.io",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@osaas/client-core": "^0.8.0",
25
25
  "@osaas/client-intercom": "^0.1.0",
26
- "@osaas/client-transcode": "^0.6.2",
26
+ "@osaas/client-transcode": "^0.7.0",
27
27
  "chalk": "4.1.2",
28
28
  "commander": "^12.1.0",
29
29
  "fast-jwt": "^4.0.1"
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "eac8e0df426571c6f30bd867cbb1bc62387e4da7"
34
+ "gitHead": "c39b000939857bd0ebc7ae2c5b497ceea018b2eb"
35
35
  }
package/src/cli.ts CHANGED
@@ -8,6 +8,7 @@ import cmdCompare from './vmaf/cmd';
8
8
  import cmdPackager from './packager/cmd';
9
9
  import cmdLive from './live/cmd';
10
10
  import cmdIntercom from './intercom/cmd';
11
+ import cmdTranscribe from './transcribe/cmd';
11
12
 
12
13
  const cli = new Command();
13
14
 
@@ -23,4 +24,5 @@ cli.addCommand(cmdPackager());
23
24
  cli.addCommand(cmdCompare());
24
25
  cli.addCommand(cmdLive());
25
26
  cli.addCommand(cmdIntercom());
27
+ cli.addCommand(cmdTranscribe());
26
28
  cli.parse(process.argv);
@@ -0,0 +1,34 @@
1
+ import { Context } from '@osaas/client-core';
2
+ import { SubtitlingPool } from '@osaas/client-transcode';
3
+ import { Command } from 'commander';
4
+
5
+ export default function cmdTranscribe() {
6
+ const transcriber = new Command('transcribe');
7
+
8
+ transcriber
9
+ .description('Generate subtitles from video or audio using Open AI Whisper')
10
+ .argument('<source>', 'Source URL (supported protocols: http, https)')
11
+ .option('-f, --format', 'Output format (default: vtt)')
12
+ .option('-l, --language', 'Language (default: en)')
13
+ .action(async (source, options, command) => {
14
+ try {
15
+ const globalOpts = command.optsWithGlobals();
16
+ const environment = globalOpts?.env || 'prod';
17
+ const ctx = new Context({ environment });
18
+ const format = options.format || 'vtt';
19
+ const language = options.language || 'en';
20
+ const pool = new SubtitlingPool({ context: ctx, size: 1 });
21
+ if (!process.env.OPENAI_API_KEY) {
22
+ throw new Error('Environment variable OPENAI_API_KEY not set');
23
+ }
24
+ await pool.init({
25
+ openaikey: process.env.OPENAI_API_KEY
26
+ });
27
+ const result = await pool.transcribe(new URL(source), language, format);
28
+ console.log(result);
29
+ } catch (err) {
30
+ console.log((err as Error).message);
31
+ }
32
+ });
33
+ return transcriber;
34
+ }