This commit is contained in:
手瓜一十雪
2025-01-26 21:00:47 +08:00
parent 2ca6d0a00e
commit 350ced55c0
2 changed files with 3 additions and 3 deletions

View File

@@ -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);