mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-12 16:00:27 +00:00
fix: 自动化验证环境变量的ffmpeg
This commit is contained in:
@@ -7,6 +7,7 @@ import { fileTypeFromFile } from 'file-type';
|
||||
import imageSize from 'image-size';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { platform } from 'node:os';
|
||||
import { LogWrapper } from './log';
|
||||
const currentPath = dirname(fileURLToPath(import.meta.url));
|
||||
const execFileAsync = promisify(execFile);
|
||||
const getFFmpegPath = (tool: string): string => {
|
||||
@@ -19,16 +20,14 @@ const getFFmpegPath = (tool: string): string => {
|
||||
};
|
||||
export let FFMPEG_CMD = getFFmpegPath('ffmpeg');
|
||||
export let FFPROBE_CMD = getFFmpegPath('ffprobe');
|
||||
console.log('[Info] ffmpeg:', FFMPEG_CMD);
|
||||
console.log('[Info] ffprobe:', FFPROBE_CMD);
|
||||
export class FFmpegService {
|
||||
// 确保目标目录存在
|
||||
public static setFfmpegPath(ffmpegPath: string): void {
|
||||
public static setFfmpegPath(ffmpegPath: string,logger:LogWrapper): void {
|
||||
if (platform() === 'win32') {
|
||||
FFMPEG_CMD = path.join(ffmpegPath, 'ffmpeg.exe');
|
||||
FFPROBE_CMD = path.join(ffmpegPath, 'ffprobe.exe');
|
||||
console.log('[Info] ffmpeg:', FFMPEG_CMD);
|
||||
console.log('[Info] ffprobe:', FFPROBE_CMD);
|
||||
logger.log('[Check] ffmpeg:', FFMPEG_CMD);
|
||||
logger.log('[Check] ffprobe:', FFPROBE_CMD);
|
||||
}
|
||||
}
|
||||
private static ensureDirExists(filePath: string): void {
|
||||
|
||||
Reference in New Issue
Block a user