@editframe/cli 0.12.0-beta.2 → 0.12.0-beta.6
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/VERSION.d.ts +1 -1
- package/dist/VERSION.js +1 -1
- package/dist/commands/process-file.js +9 -23
- package/dist/operations/getRenderInfo.d.ts +2 -2
- package/dist/operations/syncAssetsDirectory/SyncImage.js +5 -3
- package/dist/operations/syncAssetsDirectory/SyncTrack.d.ts +2 -2
- package/dist/utils/validateVideoResolution.d.ts +1 -1
- package/package.json +5 -5
- package/src/commands/process-file.ts +10 -28
- package/src/operations/syncAssetsDirectory/SyncImage.ts +4 -2
package/dist/VERSION.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.12.0-beta.
|
|
1
|
+
export declare const VERSION = "0.12.0-beta.6";
|
package/dist/VERSION.js
CHANGED
|
@@ -1,44 +1,30 @@
|
|
|
1
|
-
import { createReadStream } from "node:fs";
|
|
2
|
-
import { stat } from "node:fs/promises";
|
|
3
|
-
import { basename } from "node:path";
|
|
4
1
|
import { program } from "commander";
|
|
5
2
|
import { withSpinner } from "../utils/withSpinner.js";
|
|
6
|
-
import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo,
|
|
7
|
-
import { md5FilePath } from "@editframe/assets";
|
|
3
|
+
import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFileFromPath, processIsobmffFile } from "@editframe/api";
|
|
8
4
|
import ora from "ora";
|
|
9
|
-
import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.js";
|
|
10
5
|
import { getClient } from "../utils/index.js";
|
|
11
6
|
program.command("process-file <file>").description("Upload a audio/video to Editframe for processing.").action(async (path) => {
|
|
12
7
|
const client = getClient();
|
|
13
|
-
const md5 = await md5FilePath(path);
|
|
14
|
-
const byte_size = (await stat(path)).size;
|
|
15
8
|
const unprocessedFile = await withSpinner(
|
|
16
9
|
"Creating unprocessed file record",
|
|
17
|
-
|
|
18
|
-
md5,
|
|
19
|
-
filename: basename(path),
|
|
20
|
-
byte_size
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
const readStream = createReadStream(path);
|
|
24
|
-
const upload = uploadUnprocessedFile(
|
|
25
|
-
client,
|
|
26
|
-
unprocessedFile.id,
|
|
27
|
-
createReadableStreamFromReadable(readStream),
|
|
28
|
-
byte_size
|
|
10
|
+
() => createUnprocessedFileFromPath(client, path)
|
|
29
11
|
);
|
|
12
|
+
const upload = await uploadUnprocessedFile(client, unprocessedFile, path);
|
|
30
13
|
const uploadSpinner = ora("Uploading file");
|
|
31
14
|
for await (const event of upload) {
|
|
32
15
|
uploadSpinner.text = `Uploading file: ${(100 * event.progress).toFixed(2)}%`;
|
|
33
16
|
}
|
|
34
17
|
uploadSpinner.succeed("Upload complete");
|
|
35
|
-
const
|
|
18
|
+
const processorRecord = await withSpinner(
|
|
36
19
|
"Marking for processing",
|
|
37
20
|
async () => await processIsobmffFile(client, unprocessedFile.id)
|
|
38
21
|
);
|
|
39
22
|
const processSpinner = ora("Waiting for processing to complete");
|
|
40
23
|
processSpinner.start();
|
|
41
|
-
const progress = await getIsobmffProcessProgress(
|
|
24
|
+
const progress = await getIsobmffProcessProgress(
|
|
25
|
+
client,
|
|
26
|
+
processorRecord.id
|
|
27
|
+
);
|
|
42
28
|
for await (const event of progress) {
|
|
43
29
|
if (event.type === "progress") {
|
|
44
30
|
processSpinner.text = `Processing: ${(100 * event.data.progress).toFixed(2)}%`;
|
|
@@ -46,7 +32,7 @@ program.command("process-file <file>").description("Upload a audio/video to Edit
|
|
|
46
32
|
processSpinner.succeed("Processing complete");
|
|
47
33
|
}
|
|
48
34
|
}
|
|
49
|
-
const info = await getIsobmffProcessInfo(client,
|
|
35
|
+
const info = await getIsobmffProcessInfo(client, processorRecord.id);
|
|
50
36
|
console.log("Processed file info");
|
|
51
37
|
console.log(info);
|
|
52
38
|
});
|
|
@@ -18,8 +18,8 @@ export declare const RenderInfo: z.ZodObject<{
|
|
|
18
18
|
efImage: string[];
|
|
19
19
|
}>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
height: number;
|
|
22
21
|
width: number;
|
|
22
|
+
height: number;
|
|
23
23
|
fps: number;
|
|
24
24
|
assets: {
|
|
25
25
|
efMedia: Record<string, any>;
|
|
@@ -28,8 +28,8 @@ export declare const RenderInfo: z.ZodObject<{
|
|
|
28
28
|
};
|
|
29
29
|
durationMs: number;
|
|
30
30
|
}, {
|
|
31
|
-
height: number;
|
|
32
31
|
width: number;
|
|
32
|
+
height: number;
|
|
33
33
|
fps: number;
|
|
34
34
|
assets: {
|
|
35
35
|
efMedia: Record<string, any>;
|
|
@@ -74,9 +74,11 @@ class SyncImage {
|
|
|
74
74
|
}
|
|
75
75
|
await uploadImageFile(
|
|
76
76
|
getClient(),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
{
|
|
78
|
+
id: this.created.id,
|
|
79
|
+
byte_size: Number.parseInt(this.probeResult.format.size || "0")
|
|
80
|
+
},
|
|
81
|
+
createReadableStreamFromReadable(createReadStream(this.path))
|
|
80
82
|
).whenUploaded();
|
|
81
83
|
}
|
|
82
84
|
async markSynced() {
|
|
@@ -39,8 +39,6 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
|
|
|
39
39
|
disposition: Record<string, unknown>;
|
|
40
40
|
initial_padding?: number | undefined;
|
|
41
41
|
} | {
|
|
42
|
-
height: number;
|
|
43
|
-
width: number;
|
|
44
42
|
index: number;
|
|
45
43
|
codec_name: string;
|
|
46
44
|
codec_long_name: string;
|
|
@@ -51,6 +49,8 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
|
|
|
51
49
|
avg_frame_rate: string;
|
|
52
50
|
time_base: string;
|
|
53
51
|
disposition: Record<string, unknown>;
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
54
|
coded_width: number;
|
|
55
55
|
coded_height: number;
|
|
56
56
|
start_pts?: number | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/cli",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.6",
|
|
4
4
|
"description": "Command line interface for EditFrame",
|
|
5
5
|
"bin": {
|
|
6
6
|
"editframe": "./dist/index.js"
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"vite-tsconfig-paths": "^4.3.2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@editframe/api": "0.12.0-beta.
|
|
27
|
-
"@editframe/assets": "0.12.0-beta.
|
|
28
|
-
"@editframe/elements": "0.12.0-beta.
|
|
29
|
-
"@editframe/vite-plugin": "0.12.0-beta.
|
|
26
|
+
"@editframe/api": "0.12.0-beta.6",
|
|
27
|
+
"@editframe/assets": "0.12.0-beta.6",
|
|
28
|
+
"@editframe/elements": "0.12.0-beta.6",
|
|
29
|
+
"@editframe/vite-plugin": "0.12.0-beta.6",
|
|
30
30
|
"@inquirer/prompts": "^5.3.8",
|
|
31
31
|
"axios": "^1.6.8",
|
|
32
32
|
"chalk": "^5.3.0",
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { createReadStream } from "node:fs";
|
|
2
|
-
import { stat } from "node:fs/promises";
|
|
3
|
-
import { basename } from "node:path";
|
|
4
|
-
|
|
5
1
|
import { program } from "commander";
|
|
6
2
|
|
|
7
3
|
import { withSpinner } from "../utils/withSpinner.ts";
|
|
8
4
|
|
|
9
5
|
import {
|
|
10
|
-
|
|
6
|
+
createUnprocessedFileFromPath,
|
|
11
7
|
getIsobmffProcessInfo,
|
|
12
8
|
getIsobmffProcessProgress,
|
|
13
9
|
processIsobmffFile,
|
|
14
10
|
uploadUnprocessedFile,
|
|
15
11
|
} from "@editframe/api";
|
|
16
|
-
import { md5FilePath } from "@editframe/assets";
|
|
17
12
|
import ora from "ora";
|
|
18
|
-
import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.ts";
|
|
19
13
|
import { getClient } from "../utils/index.ts";
|
|
20
14
|
|
|
21
15
|
program
|
|
@@ -24,41 +18,29 @@ program
|
|
|
24
18
|
.action(async (path: string) => {
|
|
25
19
|
const client = getClient();
|
|
26
20
|
|
|
27
|
-
const md5 = await md5FilePath(path);
|
|
28
|
-
|
|
29
|
-
const byte_size = (await stat(path)).size;
|
|
30
|
-
|
|
31
21
|
const unprocessedFile = await withSpinner(
|
|
32
22
|
"Creating unprocessed file record",
|
|
33
|
-
|
|
34
|
-
await createUnprocessedFile(client, {
|
|
35
|
-
md5,
|
|
36
|
-
filename: basename(path),
|
|
37
|
-
byte_size,
|
|
38
|
-
}),
|
|
23
|
+
() => createUnprocessedFileFromPath(client, path),
|
|
39
24
|
);
|
|
40
25
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const upload = uploadUnprocessedFile(
|
|
44
|
-
client,
|
|
45
|
-
unprocessedFile.id,
|
|
46
|
-
createReadableStreamFromReadable(readStream),
|
|
47
|
-
byte_size,
|
|
48
|
-
);
|
|
26
|
+
const upload = await uploadUnprocessedFile(client, unprocessedFile, path);
|
|
49
27
|
const uploadSpinner = ora("Uploading file");
|
|
28
|
+
|
|
50
29
|
for await (const event of upload) {
|
|
51
30
|
uploadSpinner.text = `Uploading file: ${(100 * event.progress).toFixed(2)}%`;
|
|
52
31
|
}
|
|
53
32
|
uploadSpinner.succeed("Upload complete");
|
|
54
|
-
const
|
|
33
|
+
const processorRecord = await withSpinner(
|
|
55
34
|
"Marking for processing",
|
|
56
35
|
async () => await processIsobmffFile(client, unprocessedFile.id),
|
|
57
36
|
);
|
|
58
37
|
|
|
59
38
|
const processSpinner = ora("Waiting for processing to complete");
|
|
60
39
|
processSpinner.start();
|
|
61
|
-
const progress = await getIsobmffProcessProgress(
|
|
40
|
+
const progress = await getIsobmffProcessProgress(
|
|
41
|
+
client,
|
|
42
|
+
processorRecord.id,
|
|
43
|
+
);
|
|
62
44
|
|
|
63
45
|
for await (const event of progress) {
|
|
64
46
|
if (event.type === "progress") {
|
|
@@ -68,7 +50,7 @@ program
|
|
|
68
50
|
}
|
|
69
51
|
}
|
|
70
52
|
|
|
71
|
-
const info = await getIsobmffProcessInfo(client,
|
|
53
|
+
const info = await getIsobmffProcessInfo(client, processorRecord.id);
|
|
72
54
|
|
|
73
55
|
console.log("Processed file info");
|
|
74
56
|
console.log(info);
|
|
@@ -97,9 +97,11 @@ export class SyncImage implements SubAssetSync<CreateImageFileResult> {
|
|
|
97
97
|
}
|
|
98
98
|
await uploadImageFile(
|
|
99
99
|
getClient(),
|
|
100
|
-
|
|
100
|
+
{
|
|
101
|
+
id: this.created.id,
|
|
102
|
+
byte_size: Number.parseInt(this.probeResult.format.size || "0"),
|
|
103
|
+
},
|
|
101
104
|
createReadableStreamFromReadable(createReadStream(this.path)),
|
|
102
|
-
Number.parseInt(this.probeResult.format.size || "0"),
|
|
103
105
|
).whenUploaded();
|
|
104
106
|
}
|
|
105
107
|
async markSynced() {
|