Merge branch 'immich-app:main' into feat/samsung-raw-and-fujifilm-raf
This commit is contained in:
@@ -154,13 +154,6 @@ export class MetadataExtractionProcessor {
|
||||
return exifDate.toDate();
|
||||
};
|
||||
|
||||
const getExposureTimeDenominator = (exposureTime: string | undefined) => {
|
||||
if (!exposureTime) return null;
|
||||
|
||||
const exposureTimeSplit = exposureTime.split('/');
|
||||
return exposureTimeSplit.length === 2 ? parseInt(exposureTimeSplit[1]) : null;
|
||||
};
|
||||
|
||||
const createdAt = exifToDate(exifData?.DateTimeOriginal ?? exifData?.CreateDate ?? asset.createdAt);
|
||||
const modifyDate = exifToDate(exifData?.ModifyDate ?? asset.modifiedAt);
|
||||
const fileStats = fs.statSync(asset.originalPath);
|
||||
@@ -174,7 +167,7 @@ export class MetadataExtractionProcessor {
|
||||
newExif.model = exifData?.Model || null;
|
||||
newExif.exifImageHeight = exifData?.ExifImageHeight || exifData?.ImageHeight || null;
|
||||
newExif.exifImageWidth = exifData?.ExifImageWidth || exifData?.ImageWidth || null;
|
||||
newExif.exposureTime = getExposureTimeDenominator(exifData?.ExposureTime);
|
||||
newExif.exposureTime = exifData?.ExposureTime || null;
|
||||
newExif.orientation = exifData?.Orientation?.toString() || null;
|
||||
newExif.dateTimeOriginal = createdAt;
|
||||
newExif.modifyDate = modifyDate;
|
||||
@@ -223,7 +216,7 @@ export class MetadataExtractionProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
await this.exifRepository.save(newExif);
|
||||
await this.exifRepository.upsert(newExif, { conflictPaths: ['assetId'] });
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Error extracting EXIF ${error}`, error?.stack);
|
||||
}
|
||||
@@ -334,7 +327,7 @@ export class MetadataExtractionProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
await this.exifRepository.save(newExif);
|
||||
await this.exifRepository.upsert(newExif, { conflictPaths: ['assetId'] });
|
||||
await this.assetRepository.update({ id: asset.id }, { duration: durationString, createdAt: createdAt });
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Repository } from 'typeorm';
|
||||
|
||||
@Processor(QueueName.VIDEO_CONVERSION)
|
||||
export class VideoTranscodeProcessor {
|
||||
readonly logger = new Logger(VideoTranscodeProcessor.name);
|
||||
constructor(
|
||||
@InjectRepository(AssetEntity)
|
||||
private assetRepository: Repository<AssetEntity>,
|
||||
@@ -20,7 +21,6 @@ export class VideoTranscodeProcessor {
|
||||
@Process({ name: JobName.VIDEO_CONVERSION, concurrency: 2 })
|
||||
async videoConversion(job: Job<IVideoConversionProcessor>) {
|
||||
const { asset } = job.data;
|
||||
|
||||
const basePath = APP_UPLOAD_LOCATION;
|
||||
const encodedVideoPath = `${basePath}/${asset.userId}/encoded-video`;
|
||||
|
||||
@@ -30,17 +30,14 @@ export class VideoTranscodeProcessor {
|
||||
|
||||
const savedEncodedPath = `${encodedVideoPath}/${asset.id}.mp4`;
|
||||
|
||||
if (!asset.encodedVideoPath) {
|
||||
// Put the processing into its own async function to prevent the job exist right away
|
||||
await this.runVideoEncode(asset, savedEncodedPath);
|
||||
}
|
||||
await this.runVideoEncode(asset, savedEncodedPath);
|
||||
}
|
||||
|
||||
async runFFProbePipeline(asset: AssetEntity): Promise<FfprobeData> {
|
||||
return new Promise((resolve, reject) => {
|
||||
ffmpeg.ffprobe(asset.originalPath, (err, data) => {
|
||||
if (err || !data) {
|
||||
Logger.error(`Cannot probe video ${err}`, 'mp4Conversion');
|
||||
this.logger.error(`Cannot probe video ${err}`, 'runFFProbePipeline');
|
||||
reject(err);
|
||||
}
|
||||
|
||||
@@ -88,14 +85,14 @@ export class VideoTranscodeProcessor {
|
||||
])
|
||||
.output(savedEncodedPath)
|
||||
.on('start', () => {
|
||||
Logger.log('Start Converting Video', 'mp4Conversion');
|
||||
this.logger.log('Start Converting Video');
|
||||
})
|
||||
.on('error', (error) => {
|
||||
Logger.error(`Cannot Convert Video ${error}`, 'mp4Conversion');
|
||||
this.logger.error(`Cannot Convert Video ${error}`);
|
||||
reject();
|
||||
})
|
||||
.on('end', async () => {
|
||||
Logger.log(`Converting Success ${asset.id}`, 'mp4Conversion');
|
||||
this.logger.log(`Converting Success ${asset.id}`);
|
||||
await this.assetRepository.update({ id: asset.id }, { encodedVideoPath: savedEncodedPath });
|
||||
resolve();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user