diff --git a/internal/meta/json_test.go b/internal/meta/json_test.go index f880f98bf..02e81959a 100644 --- a/internal/meta/json_test.go +++ b/internal/meta/json_test.go @@ -1209,4 +1209,54 @@ func TestJSON(t *testing.T) { //TODO //assert.Equal(t, "zqdtcxt1q9wrxnur", data.DocumentID) }) + + t.Run("iPhone_6s.json", func(t *testing.T) { + data, err := JSON("testdata/iPhone_6s.json", "") + + if err != nil { + t.Fatal(err) + } + + // t.Logf("DATA: %+v", data) + + assert.Equal(t, CodecJpeg, data.Codec) + assert.Equal(t, "0s", data.Duration.String()) + assert.Equal(t, "2022-11-02 12:54:16 +0000 UTC", data.TakenAtLocal.String()) + assert.Equal(t, "2022-11-02 11:54:16 +0000 UTC", data.TakenAt.String()) + assert.Equal(t, 698000000, data.TakenNs) + assert.Equal(t, "", data.TimeZone) + assert.Equal(t, 4032, data.Width) + assert.Equal(t, 3024, data.Height) + assert.Equal(t, 6, data.Orientation) + assert.Equal(t, float32(0), data.Lat) + assert.Equal(t, float32(0), data.Lng) + assert.Equal(t, "Apple", data.CameraMake) + assert.Equal(t, "iPhone 6s", data.CameraModel) + assert.Equal(t, "iPhone 6s back camera 4.15mm f/2.2", data.LensModel) + }) + + t.Run("iPhone_14_Pro.json", func(t *testing.T) { + data, err := JSON("testdata/iPhone_14_Pro.json", "") + + if err != nil { + t.Fatal(err) + } + + // t.Logf("DATA: %+v", data) + + assert.Equal(t, CodecJpeg, data.Codec) + assert.Equal(t, "0s", data.Duration.String()) + assert.Equal(t, "2022-09-23 13:30:04 +0000 UTC", data.TakenAtLocal.String()) + assert.Equal(t, "2022-09-23 12:30:04 +0000 UTC", data.TakenAt.String()) + assert.Equal(t, 630000000, data.TakenNs) + assert.Equal(t, "", data.TimeZone) + assert.Equal(t, 4032, data.Width) + assert.Equal(t, 3024, data.Height) + assert.Equal(t, 1, data.Orientation) + assert.Equal(t, float32(0), data.Lat) + assert.Equal(t, float32(0), data.Lng) + assert.Equal(t, "Apple", data.CameraMake) + assert.Equal(t, "iPhone 14 Pro Max", data.CameraModel) + assert.Equal(t, "iPhone 14 Pro Max back triple camera 9mm f/2.8", data.LensModel) + }) } diff --git a/internal/meta/testdata/iPhone_14_Pro.json b/internal/meta/testdata/iPhone_14_Pro.json new file mode 100644 index 000000000..4b23b6b45 --- /dev/null +++ b/internal/meta/testdata/iPhone_14_Pro.json @@ -0,0 +1,119 @@ +[{ + "SourceFile": "IMG_4921.jpg", + "ExifToolVersion": 12.16, + "FileName": "IMG_4921.jpg", + "Directory": ".", + "FileSize": 3173193, + "FileModifyDate": "2022:11:15 16:58:11+01:00", + "FileAccessDate": "2022:11:15 16:58:42+01:00", + "FileInodeChangeDate": "2022:11:15 16:58:52+01:00", + "FilePermissions": 664, + "FileType": "JPEG", + "FileTypeExtension": "JPG", + "MIMEType": "image/jpeg", + "JFIFVersion": "1 1", + "ExifByteOrder": "MM", + "Make": "Apple", + "Model": "iPhone 14 Pro Max", + "Orientation": 1, + "XResolution": 72, + "YResolution": 72, + "ResolutionUnit": 2, + "Software": 16.0, + "ModifyDate": "2022:09:23 13:30:04", + "HostComputer": "iPhone 14 Pro Max", + "ExposureTime": 0.0004589261129, + "FNumber": 2.8, + "ExposureProgram": 2, + "ISO": 32, + "ExifVersion": "0232", + "DateTimeOriginal": "2022:09:23 13:30:04", + "CreateDate": "2022:09:23 13:30:04", + "OffsetTime": "+01:00", + "OffsetTimeOriginal": "+01:00", + "OffsetTimeDigitized": "+01:00", + "ShutterSpeedValue": "0.00045900000188041", + "ApertureValue": 2.79999999966959, + "BrightnessValue": 10.66268805, + "ExposureCompensation": 0, + "MeteringMode": 5, + "Flash": 16, + "FocalLength": 9, + "SubjectArea": "2022 1518 2320 1333", + "RunTimeFlags": 1, + "RunTimeValue": 63643798047958, + "RunTimeScale": 1000000000, + "RunTimeEpoch": 0, + "AccelerationVector": "-0.9861353044 0.02368136124 0.1148725004", + "ContentIdentifier": "E5F10D35-06C3-4F75-A00C-50B793A6C325", + "SubSecTimeOriginal": 630, + "SubSecTimeDigitized": 630, + "ColorSpace": 65535, + "ExifImageWidth": 4032, + "ExifImageHeight": 3024, + "SensingMethod": 2, + "SceneType": 1, + "ExposureMode": 0, + "WhiteBalance": 0, + "DigitalZoomRatio": 1.054393305, + "FocalLengthIn35mmFormat": 81, + "ImageUniqueID": "46eab107335800a40000000000000000", + "LensInfo": "2.220000029 9 1.779999971 2.8", + "LensMake": "Apple", + "LensModel": "iPhone 14 Pro Max back triple camera 9mm f/2.8", + "CompositeImage": 2, + "GPSVersionID": "2 2 0 0", + "GPSAltitudeRef": 0, + "GPSHPositioningError": 13.18486582, + "Compression": 6, + "ThumbnailOffset": 2534, + "ThumbnailLength": 6119, + "ProfileCMMType": "appl", + "ProfileVersion": 1024, + "ProfileClass": "mntr", + "ColorSpaceData": "RGB ", + "ProfileConnectionSpace": "XYZ ", + "ProfileDateTime": "2022:01:01 00:00:00", + "ProfileFileSignature": "acsp", + "PrimaryPlatform": "APPL", + "CMMFlags": 0, + "DeviceManufacturer": "APPL", + "DeviceModel": "", + "DeviceAttributes": "0 0", + "RenderingIntent": 0, + "ConnectionSpaceIlluminant": "0.9642 1 0.82491", + "ProfileCreator": "appl", + "ProfileID": "236 253 163 142 56 133 71 195 109 180 189 79 122 218 24 47", + "ProfileDescription": "Display P3", + "ProfileCopyright": "Copyright Apple Inc., 2022", + "MediaWhitePoint": "0.96419 1 0.82489", + "RedMatrixColumn": "0.51512 0.2412 -0.00105", + "GreenMatrixColumn": "0.29198 0.69225 0.04189", + "BlueMatrixColumn": "0.1571 0.06657 0.78407", + "RedTRC": "(Binary data 32 bytes, use -b option to extract)", + "ChromaticAdaptation": "1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168", + "BlueTRC": "(Binary data 32 bytes, use -b option to extract)", + "GreenTRC": "(Binary data 32 bytes, use -b option to extract)", + "ImageWidth": 4032, + "ImageHeight": 3024, + "EncodingProcess": 0, + "BitsPerSample": 8, + "ColorComponents": 3, + "YCbCrSubSampling": "2 2", + "RunTimeSincePowerUp": 63643.798047958, + "Aperture": 2.8, + "ImageSize": "4032 3024", + "LensID": "iPhone 14 Pro Max back triple camera 9mm f/2.8", + "Megapixels": 12.192768, + "ScaleFactor35efl": 9, + "ShutterSpeed": 0.0004589261129, + "SubSecCreateDate": "2022:09:23 13:30:04.630+01:00", + "SubSecDateTimeOriginal": "2022:09:23 13:30:04.630+01:00", + "SubSecModifyDate": "2022:09:23 13:30:04+01:00", + "ThumbnailImage": "(Binary data 6119 bytes, use -b option to extract)", + "CircleOfConfusion": 0.0033384734032074, + "FOV": 25.0576365835832, + "FocalLength35efl": 81, + "HyperfocalDistance": 8.66520949388982, + "LightValue": 15.704160325218 +}] diff --git a/internal/meta/testdata/iPhone_6s.json b/internal/meta/testdata/iPhone_6s.json new file mode 100644 index 000000000..bec8b4025 --- /dev/null +++ b/internal/meta/testdata/iPhone_6s.json @@ -0,0 +1,89 @@ +[{ + "SourceFile": "IMG_3152.JPG", + "ExifToolVersion": 12.16, + "FileName": "IMG_3152.JPG", + "Directory": ".", + "FileSize": 2495046, + "FileModifyDate": "2022:11:15 16:58:08+01:00", + "FileAccessDate": "2022:11:15 16:58:42+01:00", + "FileInodeChangeDate": "2022:11:15 16:58:42+01:00", + "FilePermissions": 664, + "FileType": "JPEG", + "FileTypeExtension": "JPG", + "MIMEType": "image/jpeg", + "ExifByteOrder": "MM", + "Make": "Apple", + "Model": "iPhone 6s", + "Orientation": 6, + "XResolution": 72, + "YResolution": 72, + "ResolutionUnit": 2, + "Software": 15.6, + "ModifyDate": "2022:11:02 12:54:16", + "HostComputer": "iPhone 6s", + "YCbCrPositioning": 1, + "ExposureTime": 0.0303030303, + "FNumber": 2.2, + "ExposureProgram": 2, + "ISO": 32, + "ExifVersion": "0232", + "DateTimeOriginal": "2022:11:02 12:54:16", + "CreateDate": "2022:11:02 12:54:16", + "OffsetTime": "+01:00", + "OffsetTimeOriginal": "+01:00", + "OffsetTimeDigitized": "+01:00", + "ComponentsConfiguration": "1 2 3 0", + "ShutterSpeedValue": 0.02998799996916, + "ApertureValue": 2.20000000038133, + "BrightnessValue": 4.55090923, + "ExposureCompensation": 0, + "MeteringMode": 5, + "Flash": 16, + "FocalLength": 4.15, + "SubjectArea": "2015 1511 2217 1330", + "RunTimeFlags": 1, + "RunTimeValue": 93327107772000, + "RunTimeScale": 1000000000, + "RunTimeEpoch": 0, + "AccelerationVector": "-0.01626883073 -0.1062001959 -1.005951404", + "SubSecTimeOriginal": 698, + "SubSecTimeDigitized": 698, + "FlashpixVersion": "0100", + "ColorSpace": 1, + "ExifImageWidth": 4032, + "ExifImageHeight": 3024, + "SensingMethod": 2, + "SceneType": 1, + "ExposureMode": 0, + "WhiteBalance": 0, + "FocalLengthIn35mmFormat": 29, + "SceneCaptureType": 0, + "LensInfo": "4.150000095 4.150000095 2.2 2.2", + "LensMake": "Apple", + "LensModel": "iPhone 6s back camera 4.15mm f/2.2", + "Compression": 6, + "ThumbnailOffset": 2080, + "ThumbnailLength": 9265, + "ImageWidth": 4032, + "ImageHeight": 3024, + "EncodingProcess": 0, + "BitsPerSample": 8, + "ColorComponents": 3, + "YCbCrSubSampling": "2 2", + "RunTimeSincePowerUp": 93327.107772, + "Aperture": 2.2, + "ImageSize": "4032 3024", + "LensID": "iPhone 6s back camera 4.15mm f/2.2", + "Megapixels": 12.192768, + "ScaleFactor35efl": 6.98795180722891, + "ShutterSpeed": 0.0303030303, + "SubSecCreateDate": "2022:11:02 12:54:16.698+01:00", + "SubSecDateTimeOriginal": "2022:11:02 12:54:16.698+01:00", + "SubSecModifyDate": "2022:11:02 12:54:16+01:00", + "ThumbnailImage": "(Binary data 9265 bytes, use -b option to extract)", + "CircleOfConfusion": "0.00429972350378608", + "FOV": 63.6549469203797, + "FocalLength35efl": 29, + "HyperfocalDistance": 1.8206773258829, + "LightValue": 8.96325735677732 +}]