mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(server): missing exif extract nightly task (#754)
* fix: nightly reverse geocoding task checking for mapbox * refactor: remove file size from image processor and queue data * feat: add missing exif nightly job * Remove filesize requirement in assetUploadedProcessorName queue insertion Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -97,7 +97,7 @@ export class AssetController {
|
||||
|
||||
await this.assetUploadedQueue.add(
|
||||
assetUploadedProcessorName,
|
||||
{ asset: savedAsset, fileName: file.originalname, fileSize: file.size },
|
||||
{ asset: savedAsset, fileName: file.originalname },
|
||||
{ jobId: savedAsset.id },
|
||||
);
|
||||
|
||||
|
||||
@@ -8,14 +8,16 @@ import { Queue } from 'bull';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { ExifEntity } from '@app/database/entities/exif.entity';
|
||||
import {
|
||||
exifExtractionProcessorName,
|
||||
generateWEBPThumbnailProcessorName,
|
||||
IMetadataExtractionJob,
|
||||
IVideoTranscodeJob,
|
||||
metadataExtractionQueueName,
|
||||
thumbnailGeneratorQueueName,
|
||||
videoConversionQueueName,
|
||||
generateWEBPThumbnailProcessorName,
|
||||
mp4ConversionProcessorName,
|
||||
reverseGeocodingProcessorName,
|
||||
thumbnailGeneratorQueueName,
|
||||
videoConversionQueueName,
|
||||
videoMetadataExtractionProcessorName,
|
||||
} from '@app/job';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@@ -82,9 +84,9 @@ export class ScheduleTasksService {
|
||||
|
||||
@Cron(CronExpression.EVERY_DAY_AT_2AM)
|
||||
async reverseGeocoding() {
|
||||
const isMapboxEnable = this.configService.get('ENABLE_MAPBOX');
|
||||
const isGeocodingEnabled = this.configService.get('DISABLE_REVERSE_GEOCODING') !== 'true';
|
||||
|
||||
if (isMapboxEnable) {
|
||||
if (isGeocodingEnabled) {
|
||||
const exifInfo = await this.exifRepository.find({
|
||||
where: {
|
||||
city: IsNull(),
|
||||
@@ -96,11 +98,36 @@ export class ScheduleTasksService {
|
||||
for (const exif of exifInfo) {
|
||||
await this.metadataExtractionQueue.add(
|
||||
reverseGeocodingProcessorName,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
{ exifId: exif.id, latitude: exif.latitude!, longitude: exif.longitude! },
|
||||
{ jobId: randomUUID() },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Cron(CronExpression.EVERY_DAY_AT_3AM)
|
||||
async extractExif() {
|
||||
const exifAssets = await this.assetRepository.find({
|
||||
where: {
|
||||
exifInfo: IsNull(),
|
||||
},
|
||||
});
|
||||
|
||||
for (const asset of exifAssets) {
|
||||
if (asset.type === AssetType.VIDEO) {
|
||||
await this.metadataExtractionQueue.add(
|
||||
videoMetadataExtractionProcessorName,
|
||||
{ asset, fileName: asset.id },
|
||||
{ jobId: randomUUID() },
|
||||
);
|
||||
} else {
|
||||
await this.metadataExtractionQueue.add(
|
||||
exifExtractionProcessorName,
|
||||
{ asset, fileName: asset.id },
|
||||
{ jobId: randomUUID() },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user