Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 更改ff引用
yikaJasonMic45c24c63c62e
diff --git a/electron/util/ffprobe_static.ts b/electron/util/ffprobe_static.tsdeleted file mode 100644index ccb00d15..00000000--- a/electron/util/ffprobe_static.ts+++ /dev/null@@ -1,68 +0,0 @@-import os from 'os';-import path from 'path';-import fs from 'fs';--const platform = os.platform();-const arch = os.arch();--// 检查平台支持-if (platform !== 'darwin' && platform !== 'linux' && platform !== 'win32') {- console.error('ffprobe unsupported platform.');- // process.exit(1);-}--// 检查 macOS 架构支持-if (platform === 'darwin' && arch !== 'x64' && arch !== 'arm64') {- console.error('ffprobe unsupported architecture.');- // process.exit(1);-}--// 获取应用程序的根目录-const getAppRootDir = (): string => {- // 在开发环境中- if (process.env.NODE_ENV === 'development') {- return path.join(process.cwd(), 'node_modules', 'ffprobe-static', 'bin');- }- // 在生产环境中- if (process.type === 'renderer') {- return path.join(process.resourcesPath, 'app.asar');- }- return path.join(process.resourcesPath, 'app.asar.unpacked');-};--// 构建 ffprobe 路径-let ffprobePath: string;--if (platform === 'win32') {- ffprobePath = path.join(getAppRootDir(), 'win32', 'x64', 'ffprobe.exe');-} else if (platform === 'darwin') {- ffprobePath = path.join(- getAppRootDir(),- 'darwin',- arch === 'arm64' ? 'arm64' : 'x64',- 'ffprobe',- );-} else {- ffprobePath = path.join(- getAppRootDir(),- 'linux',- arch === 'arm64' ? 'arm64' : 'x64',- 'ffprobe',- );-}--console.log('FFprobe 路径:', ffprobePath);--// 检查文件是否存在-try {- if (!fs.existsSync(ffprobePath)) {- // TODO: 打包之后会直接走这个逻辑,直接退出- console.log('FFprobe 可执行文件不存在:', ffprobePath);- // process.exit(1);- }-} catch (err) {- console.log('检查 FFprobe 文件时出错:', err);- // process.exit(1);-}--export { ffprobePath };diff --git a/electron/util/file.ts b/electron/util/file.tsindex e99aa769..d3f1fdc9 100644--- a/electron/util/file.ts+++ b/electron/util/file.ts@@ -1,16 +1,10 @@import fs from 'fs';import mimeTypes from 'mime-types';import ffmpeg from 'fluent-ffmpeg';-import { ffprobePath } from './ffprobe_static';import path from 'path';import { net } from 'electron';import { v4 as uuidv4 } from 'uuid';-// 文件工具类-// 设置 ffprobe 路径-console.log('ffprobe 路径:', ffprobePath);-ffmpeg.setFfprobePath(ffprobePath);-export interface FileInfo {streams: Array<{codec_type: string;diff --git a/src/views/test/index.tsx b/src/views/test/index.tsxindex a38000f5..38d65b43 100644--- a/src/views/test/index.tsx+++ b/src/views/test/index.tsx@@ -1,7 +1,7 @@/** @Author: nevin* @Date: 2025-02-10 22:20:15- * @LastEditTime: 2025-04-01 16:15:14+ * @LastEditTime: 2025-04-01 16:16:21* @LastEditors: nevin* @Description: 测试页面*/@@ -15,7 +15,6 @@ export default function Text() {function addVideos(videoFiles: IVideoFile[]) {const theVideoPath = videoFiles[0].videoPath;- console.log('--------- theVideoPath', theVideoPath);setVideoPath(theVideoPath);}