mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): asset service - upload asset (#1438)
* refactor: asset upload * refactor: background service * chore: tests * Regenerate api --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
3210302ecd
commit
9428b2576b
26 changed files with 457 additions and 386 deletions
|
|
@ -0,0 +1,17 @@
|
|||
import { assetUtils } from '@app/common/utils';
|
||||
import { Process, Processor } from '@nestjs/bull';
|
||||
import { Job } from 'bull';
|
||||
import { JobName, QueueName } from '@app/domain';
|
||||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
|
||||
@Processor(QueueName.BACKGROUND_TASK)
|
||||
export class BackgroundTaskProcessor {
|
||||
@Process(JobName.DELETE_FILE_ON_DISK)
|
||||
async deleteFileOnDisk(job: Job<{ assets: AssetEntity[] }>) {
|
||||
const { assets } = job.data;
|
||||
|
||||
for (const asset of assets) {
|
||||
assetUtils.deleteFiles(asset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -235,6 +235,10 @@ export class MetadataExtractionProcessor {
|
|||
async extractVideoMetadata(job: Job<IVideoLengthExtractionProcessor>) {
|
||||
const { asset, fileName } = job.data;
|
||||
|
||||
if (!asset.isVisible) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const data = await new Promise<ffmpeg.FfprobeData>((resolve, reject) =>
|
||||
ffmpeg.ffprobe(asset.originalPath, (err, data) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue