add log for ffmpeg check

This commit is contained in:
an-lee
2024-01-10 19:03:20 +08:00
parent 4cbb164f4d
commit 4384a60e0c
2 changed files with 20 additions and 1 deletions

View File

@@ -5,6 +5,9 @@ import path from "path";
import fs from "fs-extra";
import os from "os";
import commandExists from "command-exists";
import log from "electron-log";
const logger = log.scope("settings");
const libraryPath = () => {
const _library = settings.getSync("library");
@@ -96,12 +99,18 @@ const ffmpegConfig = () => {
const ready = Boolean(_commandExists || (ffmpegPath && ffprobePath));
return {
const config = {
os: os.platform(),
arch: os.arch(),
commandExists: _commandExists,
ffmpegPath,
ffprobePath,
ready,
};
logger.info("ffmpeg config", config);
return config;
};
export default {

View File

@@ -11,6 +11,12 @@ export const FfmpegCheck = () => {
const [downloading, setDownloading] = useState(false);
const [progress, setProgress] = useState(0);
const refreshFfmpegConfig = async () => {
EnjoyApp.settings.getFfmpegConfig().then((config) => {
setFfmegConfig(config);
});
};
const downloadFfmpeg = () => {
listenToDownloadState();
setDownloading(true);
@@ -37,6 +43,10 @@ export const FfmpegCheck = () => {
return EnjoyApp.download.removeAllListeners();
}, [ffmpegConfg?.ready]);
useEffect(() => {
refreshFfmpegConfig();
}, []);
return (
<div className="w-full max-w-sm px-6">
{ffmpegConfg?.ready ? (