mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix
This commit is contained in:
@@ -8,4 +8,4 @@ export interface VideoInfo {
|
|||||||
format: string;
|
format: string;
|
||||||
size: number;
|
size: number;
|
||||||
filePath: string;
|
filePath: string;
|
||||||
}
|
}
|
||||||
|
@@ -166,14 +166,14 @@ export class NTQQFileApi {
|
|||||||
throw new Error('文件异常,大小为0');
|
throw new Error('文件异常,大小为0');
|
||||||
}
|
}
|
||||||
const thumbDir = path.replace(`${pathLib.sep}Ori${pathLib.sep}`, `${pathLib.sep}Thumb${pathLib.sep}`);
|
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`);
|
const thumbPath = pathLib.join(pathLib.dirname(thumbDir), `${md5}_0.png`);
|
||||||
try {
|
try {
|
||||||
await FFmpegService.getVideoInfo(filePath, thumbPath);
|
videoInfo = await FFmpegService.getVideoInfo(filePath, thumbPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
fs.writeFileSync(thumbPath, Buffer.from(defaultVideoThumbB64, 'base64'));
|
fs.writeFileSync(thumbPath, Buffer.from(defaultVideoThumbB64, 'base64'));
|
||||||
}
|
}
|
||||||
|
|
||||||
videoInfo.size = fileSize;
|
|
||||||
const thumbSize = (await fsPromises.stat(thumbPath)).size;
|
const thumbSize = (await fsPromises.stat(thumbPath)).size;
|
||||||
const thumbMd5 = await calculateFileMD5(thumbPath);
|
const thumbMd5 = await calculateFileMD5(thumbPath);
|
||||||
context.deleteAfterSentFiles.push(path);
|
context.deleteAfterSentFiles.push(path);
|
||||||
|
Reference in New Issue
Block a user