revert async changes for getVideoDuration
This commit is contained in:
parent
9cdd94eca3
commit
614caf70d6
2 changed files with 3 additions and 5 deletions
|
@ -70,7 +70,7 @@ app.whenReady().then(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const duration = await getVideoDuration(outFile);
|
const duration = getVideoDuration(outFile);
|
||||||
const stats = statSync(outFile);
|
const stats = statSync(outFile);
|
||||||
|
|
||||||
return { title: outFile, size: stats.size / 1024 / 1024, duration };
|
return { title: outFile, size: stats.size / 1024 / 1024, duration };
|
||||||
|
|
|
@ -10,11 +10,9 @@ export const getNewFilename = (ogFile: string, part: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Return the duration of a video in second */
|
/** Return the duration of a video in second */
|
||||||
export const getVideoDuration = async (file: string) => {
|
export const getVideoDuration = (file: string) => {
|
||||||
const command = `"${ffprobe.path}" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${file}"`;
|
const command = `"${ffprobe.path}" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${file}"`;
|
||||||
const durationString = await execute(command).then((output) =>
|
const durationString = child_process.execSync(command).toString().trim();
|
||||||
output.toString().trim()
|
|
||||||
);
|
|
||||||
return parseFloat(durationString);
|
return parseFloat(durationString);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue