Skip to content

Commit

Permalink
fix auto postprocessing error (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbach committed Jun 15, 2024
1 parent 3594711 commit b2fd2c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/main/domain/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ export const saveRecording = async (recording: RecordingData) => {
...recording.meta,
};

const folder = path.join(
await getRecordingsFolder(),
`${started.getFullYear()}-${started.getMonth() + 1}-${started.getDate()}_${started.getHours()}-${started.getMinutes()}-${started.getSeconds()}`,
);
const recordingId = `${started.getFullYear()}-${started.getMonth() + 1}-${started.getDate()}_${started.getHours()}-${started.getMinutes()}-${started.getSeconds()}`;
const folder = path.join(await getRecordingsFolder(), recordingId);
await fs.ensureDir(folder);
if (recording.mic) {
await fs.writeFile(
Expand Down Expand Up @@ -76,17 +74,15 @@ export const saveRecording = async (recording: RecordingData) => {
invalidateUiKeys(QueryKeys.History);

if ((await settings.getSettings()).ffmpeg.autoTriggerPostProcess) {
postprocess.addToQueue({ recordingId: folder });
postprocess.addToQueue({ recordingId });
postprocess.startQueue();
}
};

export const importRecording = async (file: string, meta: RecordingMeta) => {
const date = new Date(meta.started);
const folder = path.join(
await getRecordingsFolder(),
`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}_${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}`,
);
const recordingId = `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}_${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}`;
const folder = path.join(await getRecordingsFolder(), recordingId);
await fs.ensureDir(folder);
await ffmpeg.simpleTranscode(file, path.join(folder, "screen.webm"));
const fullMeta: RecordingMeta = {
Expand All @@ -101,7 +97,7 @@ export const importRecording = async (file: string, meta: RecordingMeta) => {
invalidateUiKeys(QueryKeys.History);

if ((await settings.getSettings()).ffmpeg.autoTriggerPostProcess) {
postprocess.addToQueue({ recordingId: folder });
postprocess.addToQueue({ recordingId });
postprocess.startQueue();
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/main/domain/runner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ExecaChildProcess, Options, execa } from "execa";
import log from "electron-log/main";

const processes = new Set<ExecaChildProcess<any>>();

Expand All @@ -13,6 +14,7 @@ export const execute = (
args?: readonly string[],
options?: Options,
): ExecaChildProcess => {
log.info(`Running execa on ${file}, with args: [${args?.join(",")}]`);
const process = execa(file, args, options);
processes.add(process);
return process;
Expand Down

0 comments on commit b2fd2c1

Please sign in to comment.