From ae8af84101e43c825d4555d9f6cc570f56160d03 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 8 Apr 2025 16:07:10 -0500 Subject: [PATCH] fix: no thumbnail generated for motion assets (#17472) --- server/src/services/metadata.service.spec.ts | 12 ++++-------- server/src/services/metadata.service.ts | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/server/src/services/metadata.service.spec.ts b/server/src/services/metadata.service.spec.ts index 874a84e34b..9947d803a7 100644 --- a/server/src/services/metadata.service.spec.ts +++ b/server/src/services/metadata.service.spec.ts @@ -546,7 +546,7 @@ describe(MetadataService.name, () => { id: assetStub.livePhotoWithOriginalFileName.id, livePhotoVideoId: fileStub.livePhotoMotion.uuid, }); - expect(mocks.asset.update).toHaveBeenCalledTimes(2); + expect(mocks.asset.update).toHaveBeenCalledTimes(3); }); it('should extract the EmbeddedVideo tag from Samsung JPEG motion photos', async () => { @@ -598,7 +598,7 @@ describe(MetadataService.name, () => { id: assetStub.livePhotoWithOriginalFileName.id, livePhotoVideoId: fileStub.livePhotoMotion.uuid, }); - expect(mocks.asset.update).toHaveBeenCalledTimes(2); + expect(mocks.asset.update).toHaveBeenCalledTimes(3); }); it('should extract the motion photo video from the XMP directory entry ', async () => { @@ -650,7 +650,7 @@ describe(MetadataService.name, () => { id: assetStub.livePhotoWithOriginalFileName.id, livePhotoVideoId: fileStub.livePhotoMotion.uuid, }); - expect(mocks.asset.update).toHaveBeenCalledTimes(2); + expect(mocks.asset.update).toHaveBeenCalledTimes(3); }); it('should delete old motion photo video assets if they do not match what is extracted', async () => { @@ -673,10 +673,6 @@ describe(MetadataService.name, () => { name: JobName.ASSET_DELETION, data: { id: assetStub.livePhotoWithOriginalFileName.livePhotoVideoId, deleteOnDisk: true }, }); - expect(mocks.job.queue).toHaveBeenNthCalledWith(2, { - name: JobName.METADATA_EXTRACTION, - data: { id: 'random-uuid' }, - }); }); it('should not create a new motion photo video asset if the hash of the extracted video matches an existing asset', async () => { @@ -723,7 +719,7 @@ describe(MetadataService.name, () => { id: assetStub.livePhotoStillAsset.id, livePhotoVideoId: assetStub.livePhotoMotionAsset.id, }); - expect(mocks.asset.update).toHaveBeenCalledTimes(3); + expect(mocks.asset.update).toHaveBeenCalledTimes(4); }); it('should not update storage usage if motion photo is external', async () => { diff --git a/server/src/services/metadata.service.ts b/server/src/services/metadata.service.ts index 824bf36c75..72f7270844 100644 --- a/server/src/services/metadata.service.ts +++ b/server/src/services/metadata.service.ts @@ -550,7 +550,8 @@ export class MetadataService extends BaseService { this.storageCore.ensureFolders(motionAsset.originalPath); await this.storageRepository.createFile(motionAsset.originalPath, video); this.logger.log(`Wrote motion photo video to ${motionAsset.originalPath}`); - await this.jobRepository.queue({ name: JobName.METADATA_EXTRACTION, data: { id: motionAsset.id } }); + + await this.handleMetadataExtraction({ id: motionAsset.id }); } this.logger.debug(`Finished motion photo video extraction for asset ${asset.id}: ${asset.originalPath}`);