mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-12-13 10:28:25 +00:00
recalculate size&hash after web-optimising videos
This commit is contained in:
parent
a77c32b17d
commit
76c0b646b1
1 changed files with 5 additions and 2 deletions
|
|
@ -154,8 +154,8 @@ export class DriveService {
|
||||||
@bindThis
|
@bindThis
|
||||||
private async save(file: MiDriveFile, path: string, name: string, info: FileInfo): Promise<MiDriveFile> {
|
private async save(file: MiDriveFile, path: string, name: string, info: FileInfo): Promise<MiDriveFile> {
|
||||||
const type = info.type.mime;
|
const type = info.type.mime;
|
||||||
const hash = info.md5;
|
let hash = info.md5;
|
||||||
const size = info.size;
|
let size = info.size;
|
||||||
|
|
||||||
// thunbnail, webpublic を必要なら生成
|
// thunbnail, webpublic を必要なら生成
|
||||||
const alts = await this.generateAlts(path, type, !file.uri);
|
const alts = await this.generateAlts(path, type, !file.uri);
|
||||||
|
|
@ -163,6 +163,9 @@ export class DriveService {
|
||||||
if (type && type.startsWith('video/')) {
|
if (type && type.startsWith('video/')) {
|
||||||
try {
|
try {
|
||||||
await this.videoProcessingService.webOptimizeVideo(path, type);
|
await this.videoProcessingService.webOptimizeVideo(path, type);
|
||||||
|
const newInfo = await this.fileInfoService.getFileInfo(path);
|
||||||
|
hash = newInfo.md5;
|
||||||
|
size = newInfo.size;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.registerLogger.warn(`Video optimization failed: ${renderInlineError(err)}`);
|
this.registerLogger.warn(`Video optimization failed: ${renderInlineError(err)}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue