1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-16 07:24:40 +02:00

refactor(server): use exiftool for file date metadata (#16453)

* use exiftool for file date metadata

* handle tag not existing in exifinfo (?)

* update medium tests

* fix typo

* set file size too

* set file size only if undefined
This commit is contained in:
Mert
2025-03-06 11:47:12 -05:00
committed by GitHub
parent d01b7a0d67
commit deb399ea15
4 changed files with 85 additions and 52 deletions

View File

@ -36,7 +36,7 @@ describe(MetadataService.name, () => {
beforeEach(() => {
({ sut, mocks } = newTestService(MetadataService, { metadata: metadataRepository }));
mocks.storage.stat.mockResolvedValue({ size: 123_456 } as Stats);
mocks.storage.stat.mockResolvedValue({ size: 123_456, ctime: new Date(), mtime: new Date() } as Stats);
delete process.env.TZ;
});
@ -51,6 +51,8 @@ describe(MetadataService.name, () => {
description: 'should handle no time zone information',
exifData: {
DateTimeOriginal: '2022:01:01 00:00:00',
FileCreateDate: '2022:01:01 00:00:00',
FileModifyDate: '2022:01:01 00:00:00',
},
expected: {
localDateTime: '2022-01-01T00:00:00.000Z',
@ -63,6 +65,8 @@ describe(MetadataService.name, () => {
serverTimeZone: 'America/Los_Angeles',
exifData: {
DateTimeOriginal: '2022:01:01 00:00:00',
FileCreateDate: '2022:01:01 00:00:00',
FileModifyDate: '2022:01:01 00:00:00',
},
expected: {
localDateTime: '2022-01-01T00:00:00.000Z',
@ -75,6 +79,8 @@ describe(MetadataService.name, () => {
serverTimeZone: 'Europe/Brussels',
exifData: {
DateTimeOriginal: '2022:01:01 00:00:00',
FileCreateDate: '2022:01:01 00:00:00',
FileModifyDate: '2022:01:01 00:00:00',
},
expected: {
localDateTime: '2022-01-01T00:00:00.000Z',
@ -87,6 +93,8 @@ describe(MetadataService.name, () => {
serverTimeZone: 'Europe/Brussels',
exifData: {
DateTimeOriginal: '2022:06:01 00:00:00',
FileCreateDate: '2022:06:01 00:00:00',
FileModifyDate: '2022:06:01 00:00:00',
},
expected: {
localDateTime: '2022-06-01T00:00:00.000Z',
@ -98,6 +106,8 @@ describe(MetadataService.name, () => {
description: 'should handle a +13:00 time zone',
exifData: {
DateTimeOriginal: '2022:01:01 00:00:00+13:00',
FileCreateDate: '2022:01:01 00:00:00+13:00',
FileModifyDate: '2022:01:01 00:00:00+13:00',
},
expected: {
localDateTime: '2022-01-01T00:00:00.000Z',