add blanks
This commit is contained in:
parent
84cd5014dc
commit
7d063ad8fd
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "kdenlive",
|
||||
"name": "kdenlive-ts",
|
||||
"version": "0.0.1",
|
||||
"description": "Create kdenlive projects from within JS",
|
||||
"main": "lib/index.js",
|
||||
|
@ -9,7 +9,8 @@
|
|||
"prepare": "npm run build",
|
||||
"test-reports": "npm run build && rm -fr .xunit coverage && npm run test -- --cover --test-report"
|
||||
},
|
||||
"author": "",
|
||||
"author": "Kuba Orlik",
|
||||
"repository": "https://git.internet-czas-dzialac.pl/icd/kdenlive-ts",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^9.0.0",
|
||||
|
|
20
src/entry.ts
20
src/entry.ts
|
@ -1,11 +1,17 @@
|
|||
import { Producer } from "./producer";
|
||||
|
||||
export class Entry {
|
||||
export abstract class Entry {
|
||||
abstract toXML(): string;
|
||||
}
|
||||
|
||||
export class MediaEntry extends Entry {
|
||||
constructor(
|
||||
public producer: Producer,
|
||||
public in_point: string,
|
||||
public out_point: string
|
||||
) {}
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
toXML(): string {
|
||||
return /* HTML */ `<entry
|
||||
|
@ -15,3 +21,13 @@ export class Entry {
|
|||
></entry>`;
|
||||
}
|
||||
}
|
||||
|
||||
export class BlankEntry extends Entry {
|
||||
constructor(public length: string) {
|
||||
super();
|
||||
}
|
||||
|
||||
toXML(): string {
|
||||
return `<blank length="${this.length}"/>`;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { $ } from "zx";
|
||||
import { Entry } from "./entry";
|
||||
import { BlankEntry, MediaEntry } from "./entry";
|
||||
import Project from "./kdenlive";
|
||||
|
||||
describe("Kdenlive", () => {
|
||||
|
@ -66,7 +66,11 @@ describe("Kdenlive", () => {
|
|||
const producer = project.addProducer("/home/kuba/Videos/5min.mp4");
|
||||
const video_track = project.addVideoTractor();
|
||||
const audio_track = project.addAudioTractor();
|
||||
const entry = new Entry(producer, "00:00:00.000", "00:00:01.000");
|
||||
const entry = new MediaEntry(
|
||||
producer,
|
||||
"00:00:00.000",
|
||||
"00:00:01.000"
|
||||
);
|
||||
video_track.addEntry(entry);
|
||||
audio_track.addEntry(entry);
|
||||
await $`echo ${await project.toXML()} > 1s-clip.kdenlive`;
|
||||
|
@ -77,10 +81,18 @@ describe("Kdenlive", () => {
|
|||
const producer = project.addProducer("/home/kuba/Videos/5min.mp4");
|
||||
const video_track = project.addVideoTractor();
|
||||
const audio_track = project.addAudioTractor();
|
||||
const entry = new Entry(producer, "00:00:00.000", "00:00:01.000");
|
||||
const entry = new MediaEntry(
|
||||
producer,
|
||||
"00:00:00.000",
|
||||
"00:00:01.000"
|
||||
);
|
||||
video_track.addEntry(entry);
|
||||
audio_track.addEntry(entry);
|
||||
const entry2 = new Entry(producer, "00:00:01.000", "00:00:02.000");
|
||||
const entry2 = new MediaEntry(
|
||||
producer,
|
||||
"00:00:01.000",
|
||||
"00:00:02.000"
|
||||
);
|
||||
video_track.addEntry(entry2);
|
||||
audio_track.addEntry(entry2);
|
||||
await $`echo ${await project.toXML()} > 2x1s-clip.kdenlive`;
|
||||
|
@ -92,7 +104,7 @@ describe("Kdenlive", () => {
|
|||
const video_track = project.addVideoTractor();
|
||||
const audio_track = project.addAudioTractor();
|
||||
for (let i = 0; i <= 20; i++) {
|
||||
let entry = new Entry(
|
||||
let entry = new MediaEntry(
|
||||
producer,
|
||||
`00:00:${i.toString().padStart(2, "0")}.000`,
|
||||
`00:00:${(i + 1).toString().padStart(2, "0")}.000`
|
||||
|
@ -102,5 +114,24 @@ describe("Kdenlive", () => {
|
|||
}
|
||||
await $`echo ${await project.toXML()} > 20x1s-clip.kdenlive`;
|
||||
});
|
||||
|
||||
it("should generate a 1a1v project with 10 clips with 1s pauses", async () => {
|
||||
const project = new Project(30);
|
||||
const producer = project.addProducer("/home/kuba/Videos/5min.mp4");
|
||||
const video_track = project.addVideoTractor();
|
||||
const audio_track = project.addAudioTractor();
|
||||
for (let i = 0; i <= 20; i++) {
|
||||
let entry = new MediaEntry(
|
||||
producer,
|
||||
`00:00:${i.toString().padStart(2, "0")}.000`,
|
||||
`00:00:${(i + 1).toString().padStart(2, "0")}.000`
|
||||
);
|
||||
video_track.addEntry(entry);
|
||||
audio_track.addEntry(entry);
|
||||
video_track.addEntry(new BlankEntry("00:00:01.000"));
|
||||
audio_track.addEntry(new BlankEntry("00:00:01.000"));
|
||||
}
|
||||
await $`echo ${await project.toXML()} > 10x1s-clip-with-breaks.kdenlive`;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user