From 4384a60e0c8adfa13aeb0db2a8875271850c087a Mon Sep 17 00:00:00 2001 From: an-lee Date: Wed, 10 Jan 2024 19:03:20 +0800 Subject: [PATCH] add log for ffmpeg check --- enjoy/src/main/settings.ts | 11 ++++++++++- enjoy/src/renderer/components/ffmpeg-check.tsx | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/enjoy/src/main/settings.ts b/enjoy/src/main/settings.ts index bdb4418c..8c025f41 100644 --- a/enjoy/src/main/settings.ts +++ b/enjoy/src/main/settings.ts @@ -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 { diff --git a/enjoy/src/renderer/components/ffmpeg-check.tsx b/enjoy/src/renderer/components/ffmpeg-check.tsx index d1209795..773937a7 100644 --- a/enjoy/src/renderer/components/ffmpeg-check.tsx +++ b/enjoy/src/renderer/components/ffmpeg-check.tsx @@ -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 (
{ffmpegConfg?.ready ? (