Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Jan 26, 2025
1 parent 2ca6d0a commit 350ced5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export interface VideoInfo {
format: string;
size: number;
filePath: string;
}
}
4 changes: 2 additions & 2 deletions src/core/apis/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 350ced5

Please sign in to comment.