diff --git a/test/backend/assets/sidecar/bunny_1sec.mp4 b/test/backend/assets/sidecar/bunny_1sec.mp4 new file mode 100644 index 00000000..18af94e6 Binary files /dev/null and b/test/backend/assets/sidecar/bunny_1sec.mp4 differ diff --git a/test/backend/assets/sidecar/bunny_1sec.mp4.json b/test/backend/assets/sidecar/bunny_1sec.mp4.json new file mode 100644 index 00000000..29d2cb74 --- /dev/null +++ b/test/backend/assets/sidecar/bunny_1sec.mp4.json @@ -0,0 +1,16 @@ +{ + "size": { + "width": 640, + "height": 360 + }, + "bitRate": 1794127, + "duration": 290, + "creationDate": 1709052692000, + "fileSize": 65073, + "fps": 40000, + "keywords": [ + "rabbit", + "test" + ], + "rating": 4 +} diff --git a/test/backend/assets/sidecar/bunny_1sec.mp4.xmp b/test/backend/assets/sidecar/bunny_1sec.mp4.xmp new file mode 100644 index 00000000..707ec9f3 --- /dev/null +++ b/test/backend/assets/sidecar/bunny_1sec.mp4.xmp @@ -0,0 +1,119 @@ + + + + + + 16 + + + + 0.0.0 + + + + H.264 + + + rabbit + test + + + + + + 480 + 852 + 72/1 + 72/1 + + + + 2018-11-17T20:27:31+01:00 + 2018-11-17T20:27:31+01:00 + 2018-11-17T20:27:31+01:00 + 4 + + + + + 25Timecode + 00:00:00:00 + + Stereo + 48000 + 16Int + + 1/90000 + 2928000 + + 1 + 25 + + 25Timecode + 00:00:00:00 + + Progressive + 25.000000 + + 480 + pixel + 852 + + 1/1 + + + + + d47681ee-e57e-2256-f455-43c40000004b + 2a5a623f-09cc-ea32-5014-869400000078 + xmp.did:5af8e6dd-2af0-e94e-8f3c-767794b3efa1 + + b2c5763f-bfb9-7ee1-6893-05220000004b + + + + saved + / + 63c4c09c-9648-ee43-720e-644600000078 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + saved + / + 2a5a623f-09cc-ea32-5014-869400000078 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:26:54+01:00 + + + saved + / + xmp.iid:6e43712c-17f5-cc4c-b90d-766dca2590dc + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + saved + /metadata + xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + + xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4 + xmp.did:1aa2d671-bf82-2043-9053-ec864079866c + + + + \ No newline at end of file diff --git a/test/backend/assets/sidecar/bunny_1sec_v2.mp4 b/test/backend/assets/sidecar/bunny_1sec_v2.mp4 new file mode 100644 index 00000000..18af94e6 Binary files /dev/null and b/test/backend/assets/sidecar/bunny_1sec_v2.mp4 differ diff --git a/test/backend/assets/sidecar/bunny_1sec_v2.xmp b/test/backend/assets/sidecar/bunny_1sec_v2.xmp new file mode 100644 index 00000000..707ec9f3 --- /dev/null +++ b/test/backend/assets/sidecar/bunny_1sec_v2.xmp @@ -0,0 +1,119 @@ + + + + + + 16 + + + + 0.0.0 + + + + H.264 + + + rabbit + test + + + + + + 480 + 852 + 72/1 + 72/1 + + + + 2018-11-17T20:27:31+01:00 + 2018-11-17T20:27:31+01:00 + 2018-11-17T20:27:31+01:00 + 4 + + + + + 25Timecode + 00:00:00:00 + + Stereo + 48000 + 16Int + + 1/90000 + 2928000 + + 1 + 25 + + 25Timecode + 00:00:00:00 + + Progressive + 25.000000 + + 480 + pixel + 852 + + 1/1 + + + + + d47681ee-e57e-2256-f455-43c40000004b + 2a5a623f-09cc-ea32-5014-869400000078 + xmp.did:5af8e6dd-2af0-e94e-8f3c-767794b3efa1 + + b2c5763f-bfb9-7ee1-6893-05220000004b + + + + saved + / + 63c4c09c-9648-ee43-720e-644600000078 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + saved + / + 2a5a623f-09cc-ea32-5014-869400000078 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:26:54+01:00 + + + saved + / + xmp.iid:6e43712c-17f5-cc4c-b90d-766dca2590dc + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + saved + /metadata + xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + + xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4 + xmp.did:1aa2d671-bf82-2043-9053-ec864079866c + + + + \ No newline at end of file diff --git a/test/backend/assets/sidecar/bunny_1sec_v3.mp4 b/test/backend/assets/sidecar/bunny_1sec_v3.mp4 new file mode 100644 index 00000000..18af94e6 Binary files /dev/null and b/test/backend/assets/sidecar/bunny_1sec_v3.mp4 differ diff --git a/test/backend/assets/sidecar/bunny_1sec_v3.mp4.json b/test/backend/assets/sidecar/bunny_1sec_v3.mp4.json new file mode 100644 index 00000000..8cd3db65 --- /dev/null +++ b/test/backend/assets/sidecar/bunny_1sec_v3.mp4.json @@ -0,0 +1,15 @@ +{ + "size": { + "width": 640, + "height": 360 + }, + "bitRate": 1794127, + "duration": 290, + "creationDate": 1709052692000, + "fileSize": 65073, + "fps": 40000, + "keywords": [ + "rabbit" + ], + "rating": 4 +} diff --git a/test/backend/assets/sidecar/bunny_1sec_v3.xmp b/test/backend/assets/sidecar/bunny_1sec_v3.xmp new file mode 100644 index 00000000..d56f5385 --- /dev/null +++ b/test/backend/assets/sidecar/bunny_1sec_v3.xmp @@ -0,0 +1,118 @@ + + + + + + 16 + + + + 0.0.0 + + + + H.264 + + + rabbit + + + + + + 480 + 852 + 72/1 + 72/1 + + + + 2018-11-17T20:27:31+01:00 + 2018-11-17T20:27:31+01:00 + 2018-11-17T20:27:31+01:00 + 4 + + + + + 25Timecode + 00:00:00:00 + + Stereo + 48000 + 16Int + + 1/90000 + 2928000 + + 1 + 25 + + 25Timecode + 00:00:00:00 + + Progressive + 25.000000 + + 480 + pixel + 852 + + 1/1 + + + + + d47681ee-e57e-2256-f455-43c40000004b + 2a5a623f-09cc-ea32-5014-869400000078 + xmp.did:5af8e6dd-2af0-e94e-8f3c-767794b3efa1 + + b2c5763f-bfb9-7ee1-6893-05220000004b + + + + saved + / + 63c4c09c-9648-ee43-720e-644600000078 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + saved + / + 2a5a623f-09cc-ea32-5014-869400000078 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:26:54+01:00 + + + saved + / + xmp.iid:6e43712c-17f5-cc4c-b90d-766dca2590dc + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + saved + /metadata + xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4 + Adobe Adobe Media Encoder CC 2017.1 (Windows) + 2018-11-17T20:27:31+01:00 + + + + xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4 + xmp.did:1aa2d671-bf82-2043-9053-ec864079866c + + + + \ No newline at end of file diff --git a/test/backend/assets/sidecar/no_metadata.jpg b/test/backend/assets/sidecar/no_metadata.jpg new file mode 100644 index 00000000..c119808d Binary files /dev/null and b/test/backend/assets/sidecar/no_metadata.jpg differ diff --git a/test/backend/assets/sidecar/no_metadata.jpg.json b/test/backend/assets/sidecar/no_metadata.jpg.json new file mode 100644 index 00000000..720d2a56 --- /dev/null +++ b/test/backend/assets/sidecar/no_metadata.jpg.json @@ -0,0 +1,12 @@ +{ + "size": { + "width": 10, + "height": 5 + }, + "creationDate": 1709057753000, + "fileSize": 1430, + "keywords": [ + "first", + "second" + ] +} \ No newline at end of file diff --git a/test/backend/assets/sidecar/no_metadata.jpg.xmp b/test/backend/assets/sidecar/no_metadata.jpg.xmp new file mode 100644 index 00000000..5eab57a6 --- /dev/null +++ b/test/backend/assets/sidecar/no_metadata.jpg.xmp @@ -0,0 +1,17 @@ + + + + + + + first + second + + + + + + diff --git a/test/backend/assets/sidecar/no_metadata_v2.jpg b/test/backend/assets/sidecar/no_metadata_v2.jpg new file mode 100644 index 00000000..c119808d Binary files /dev/null and b/test/backend/assets/sidecar/no_metadata_v2.jpg differ diff --git a/test/backend/assets/sidecar/no_metadata_v2.xmp b/test/backend/assets/sidecar/no_metadata_v2.xmp new file mode 100644 index 00000000..5eab57a6 --- /dev/null +++ b/test/backend/assets/sidecar/no_metadata_v2.xmp @@ -0,0 +1,17 @@ + + + + + + + first + second + + + + + + diff --git a/test/backend/assets/sidecar/no_metadata_v3.jpg b/test/backend/assets/sidecar/no_metadata_v3.jpg new file mode 100644 index 00000000..c119808d Binary files /dev/null and b/test/backend/assets/sidecar/no_metadata_v3.jpg differ diff --git a/test/backend/assets/sidecar/no_metadata_v3.jpg.json b/test/backend/assets/sidecar/no_metadata_v3.jpg.json new file mode 100644 index 00000000..3cd5fc46 --- /dev/null +++ b/test/backend/assets/sidecar/no_metadata_v3.jpg.json @@ -0,0 +1,11 @@ +{ + "size": { + "width": 10, + "height": 5 + }, + "creationDate": 1709057753000, + "fileSize": 1430, + "keywords": [ + "first" + ] +} \ No newline at end of file diff --git a/test/backend/assets/sidecar/no_metadata_v3.xmp b/test/backend/assets/sidecar/no_metadata_v3.xmp new file mode 100644 index 00000000..5f8a295a --- /dev/null +++ b/test/backend/assets/sidecar/no_metadata_v3.xmp @@ -0,0 +1,16 @@ + + + + + + + first + + + + + + diff --git a/test/backend/unit/model/threading/MetaDataLoader.spec.ts b/test/backend/unit/model/threading/MetaDataLoader.spec.ts index 0e074069..8865a67c 100644 --- a/test/backend/unit/model/threading/MetaDataLoader.spec.ts +++ b/test/backend/unit/model/threading/MetaDataLoader.spec.ts @@ -69,6 +69,55 @@ describe('MetadataLoader', () => { expect(Utils.clone(data)).to.be.deep.equal(expected); }); + it('should load sidecar file with file extension for video', async () => { + const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should load sidecar file without file extension for video', async () => { + const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v2.mp4')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json'));//sidecar "bunny_1sec_v2.xmp" is identical to "bunny_1sec.mp4.xmp" so we expect the same result + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should retrieve both keywords from sidecar file for video', async () => { + const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should retrieve one keyword from sidecar file for video', async () => { + const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v3.mp4')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v3.mp4.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should load sidecar file with file extension for photo', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should load sidecar file without file extension for photo', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v2.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg.json'));//sidecar "no_metadata_v2.xmp" is identical to "no_metadata.jpg.xmp" so we expect the same result + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should retrieve both keywords from sidecar file for photo', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should retrieve one keyword from sidecar file for photo', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v3.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v3.jpg.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + describe('should load jpg with proper height and orientation', () => { it('jpg 1', async () => { const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/orientation/broken_orientation_exif.jpg'));