From 350ced55c00b3968be66a7931523cdb65b0ec20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sun, 26 Jan 2025 21:00:47 +0800 Subject: [PATCH] fix --- src/common/video.ts | 2 +- src/core/apis/file.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/video.ts b/src/common/video.ts index 6da318ca..fb30e974 100644 --- a/src/common/video.ts +++ b/src/common/video.ts @@ -8,4 +8,4 @@ export interface VideoInfo { format: string; size: number; filePath: string; -} \ No newline at end of file +} diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index d78ead7e..a9122391 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -166,14 +166,14 @@ export class NTQQFileApi { throw new Error('文件异常,大小为0'); } const thumbDir = path.replace(`${pathLib.sep}Ori${pathLib.sep}`, `${pathLib.sep}Thumb${pathLib.sep}`); + fs.mkdirSync(pathLib.dirname(thumbDir), { recursive: true }); const thumbPath = pathLib.join(pathLib.dirname(thumbDir), `${md5}_0.png`); try { - await FFmpegService.getVideoInfo(filePath, thumbPath); + videoInfo = await FFmpegService.getVideoInfo(filePath, thumbPath); } catch (error) { fs.writeFileSync(thumbPath, Buffer.from(defaultVideoThumbB64, 'base64')); } - videoInfo.size = fileSize; const thumbSize = (await fsPromises.stat(thumbPath)).size; const thumbMd5 = await calculateFileMD5(thumbPath); context.deleteAfterSentFiles.push(path);