diff --git a/test/backend/assets/sidecar/20240107_110258.jpg b/test/backend/assets/sidecar/20240107_110258.jpg new file mode 100644 index 00000000..924a4d7f Binary files /dev/null and b/test/backend/assets/sidecar/20240107_110258.jpg differ diff --git a/test/backend/assets/sidecar/20240107_110258.jpg.xmp b/test/backend/assets/sidecar/20240107_110258.jpg.xmp new file mode 100644 index 00000000..42665535 --- /dev/null +++ b/test/backend/assets/sidecar/20240107_110258.jpg.xmp @@ -0,0 +1,73 @@ + + + + + + + + 40 + + + + + Travel + + + + + Travel + + + + + + diff --git a/test/backend/assets/sidecar/20240107_110258.json b/test/backend/assets/sidecar/20240107_110258.json new file mode 100644 index 00000000..537f61d2 --- /dev/null +++ b/test/backend/assets/sidecar/20240107_110258.json @@ -0,0 +1,22 @@ +{ + "cameraData": { + "ISO": 40, + "exposure": 0.009524, + "fStop": 2.2, + "focalLength": 3.75, + "make": "samsung", + "model": "SM-A715F" + }, + "creationDate": 1704621779177, + "creationDateOffset": "+01:00", + "fileSize": 15126, + "size": { + "height": 13, + "width": 10 + }, + "keywords": [ + "Výlet", + "Travel" + ], + "rating": 3 +} diff --git a/test/backend/assets/sidecar/20240121_102400.JPG b/test/backend/assets/sidecar/20240121_102400.JPG new file mode 100755 index 00000000..121ba391 Binary files /dev/null and b/test/backend/assets/sidecar/20240121_102400.JPG differ diff --git a/test/backend/assets/sidecar/20240121_102400.JPG.xmp b/test/backend/assets/sidecar/20240121_102400.JPG.xmp new file mode 100644 index 00000000..67fe232d --- /dev/null +++ b/test/backend/assets/sidecar/20240121_102400.JPG.xmp @@ -0,0 +1,91 @@ + + + + + + + + 1 + 2 + 3 + 0 + + + + + 100 + + + + + Travel + + + + + + + + Travel + + + + + + diff --git a/test/backend/assets/sidecar/20240121_102400.json b/test/backend/assets/sidecar/20240121_102400.json new file mode 100644 index 00000000..79005c08 --- /dev/null +++ b/test/backend/assets/sidecar/20240121_102400.json @@ -0,0 +1,23 @@ +{ + "cameraData": { + "ISO": 100, + "exposure": 0.003125, + "fStop": 6.3, + "focalLength": 16, + "lens": "NIKKOR Z DX 16-50mm f/3.5-6.3 VR", + "make": "NIKON CORPORATION", + "model": "NIKON Z 30" + }, + "creationDate": 1705829040930, + "creationDateOffset": "+01:00", + "fileSize": 25556, + "size": { + "height": 10, + "width": 15 + }, + "keywords": [ + "Výlet", + "Travel" + ], + "rating": 3 +} diff --git a/test/backend/assets/sidecar/20240128_105420.json b/test/backend/assets/sidecar/20240128_105420.json new file mode 100644 index 00000000..977a736f --- /dev/null +++ b/test/backend/assets/sidecar/20240128_105420.json @@ -0,0 +1,15 @@ +{ + "bitRate": 184871, + "creationDate": 1706432060000, + "duration": 1000, + "fileSize": 23132, + "size": { + "height": 46, + "width": 80 + }, + "fps": 60000, + "keywords": [ + "Travel" + ], + "rating": 3 +} diff --git a/test/backend/assets/sidecar/20240128_105420.mp4 b/test/backend/assets/sidecar/20240128_105420.mp4 new file mode 100644 index 00000000..1de9f155 Binary files /dev/null and b/test/backend/assets/sidecar/20240128_105420.mp4 differ diff --git a/test/backend/assets/sidecar/20240128_105420.mp4.xmp b/test/backend/assets/sidecar/20240128_105420.mp4.xmp new file mode 100644 index 00000000..47155971 --- /dev/null +++ b/test/backend/assets/sidecar/20240128_105420.mp4.xmp @@ -0,0 +1,115 @@ + + + + + + + 1 + 2 + 3 + 0 + + + + + Travel + + + + + Travel + + + + + + diff --git a/test/backend/assets/sidecar/20240128_120909.json b/test/backend/assets/sidecar/20240128_120909.json new file mode 100644 index 00000000..c13e4602 --- /dev/null +++ b/test/backend/assets/sidecar/20240128_120909.json @@ -0,0 +1,15 @@ +{ + "bitRate": 183168, + "creationDate": 1706436545000, + "duration": 1000, + "fileSize": 22896, + "size": { + "height": 80, + "width": 46 + }, + "fps": 30, + "keywords": [ + "Travel" + ], + "rating": 3 +} diff --git a/test/backend/assets/sidecar/20240128_120909.mp4 b/test/backend/assets/sidecar/20240128_120909.mp4 new file mode 100644 index 00000000..ffa60ea3 Binary files /dev/null and b/test/backend/assets/sidecar/20240128_120909.mp4 differ diff --git a/test/backend/assets/sidecar/20240128_120909.mp4.xmp b/test/backend/assets/sidecar/20240128_120909.mp4.xmp new file mode 100644 index 00000000..662428f7 --- /dev/null +++ b/test/backend/assets/sidecar/20240128_120909.mp4.xmp @@ -0,0 +1,117 @@ + + + + + + + 1 + 2 + 3 + 0 + + + + + Travel + + + + + Travel + + + + + + diff --git a/test/backend/assets/sidecar/20240128_185808.JPG b/test/backend/assets/sidecar/20240128_185808.JPG new file mode 100644 index 00000000..f9e7ebf8 Binary files /dev/null and b/test/backend/assets/sidecar/20240128_185808.JPG differ diff --git a/test/backend/assets/sidecar/20240128_185808.JPG.xmp b/test/backend/assets/sidecar/20240128_185808.JPG.xmp new file mode 100644 index 00000000..8644809b --- /dev/null +++ b/test/backend/assets/sidecar/20240128_185808.JPG.xmp @@ -0,0 +1,114 @@ + + + + + + + + 1 + 2 + 3 + 0 + + + + + 25600 + + + + + Travel + + + + + Travel + + + + + Travel + + + + + Travel + + + + + + + + Travel + + + + + + diff --git a/test/backend/assets/sidecar/20240128_185808.json b/test/backend/assets/sidecar/20240128_185808.json new file mode 100644 index 00000000..3ac57a61 --- /dev/null +++ b/test/backend/assets/sidecar/20240128_185808.json @@ -0,0 +1,23 @@ +{ + "cameraData": { + "ISO": 25600, + "exposure": 0.04, + "fStop": 4.2, + "focalLength": 25, + "lens": "NIKKOR Z DX 16-50mm f/3.5-6.3 VR", + "make": "NIKON CORPORATION", + "model": "NIKON Z 30" + }, + "creationDate": 1706464688660, + "creationDateOffset": "+01:00", + "fileSize": 47059, + "size": { + "height": 10, + "width": 15 + }, + "keywords": [ + "Výlet", + "Travel" + ], + "rating": 3 +} diff --git a/test/backend/unit/model/threading/MetaDataLoader.spec.ts b/test/backend/unit/model/threading/MetaDataLoader.spec.ts index e0b0b8c6..48a62827 100644 --- a/test/backend/unit/model/threading/MetaDataLoader.spec.ts +++ b/test/backend/unit/model/threading/MetaDataLoader.spec.ts @@ -5,6 +5,7 @@ import {Utils} from '../../../../../src/common/Utils'; import * as path from 'path'; import * as fs from 'fs'; import {PhotoProcessing} from '../../../../../src/backend/model/fileaccess/fileprocessing/PhotoProcessing'; +import {VideoProcessing} from '../../../../../src/backend/model/fileaccess/fileprocessing/VideoProcessing'; import {Config} from '../../../../../src/common/config/private/Config'; import {DatabaseType} from '../../../../../src/common/config/private/PrivateConfig'; @@ -257,4 +258,24 @@ describe('MetadataLoader', () => { expect(Utils.clone(data)).to.be.deep.equal(expected); }); + describe('should load metadata from sidecar files', () => { + const root = path.join(__dirname, '/../../../assets/sidecar'); + const files = fs.readdirSync(root); + for (const item of files) { + const fullFilePath = path.join(root, item); + if (PhotoProcessing.isPhoto(fullFilePath)) { + it(item, async () => { + const data = await MetadataLoader.loadPhotoMetadata(fullFilePath); + const expected = require(fullFilePath.split('.').slice(0, -1).join('.') + '.json'); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + } else if (VideoProcessing.isVideo(fullFilePath)) { + it(item, async () => { + const data = await MetadataLoader.loadVideoMetadata(fullFilePath); + const expected = require(fullFilePath.split('.').slice(0, -1).join('.') + '.json'); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + } + } + }); });