From b232d374adb870627331867724a325e0c880aee5 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Thu, 6 Aug 2020 10:55:15 +0200 Subject: [PATCH] Metadata: Update Exif tests and dependencies #431 Signed-off-by: Michael Mayer --- go.mod | 4 ++-- go.sum | 4 ++++ internal/meta/exif_test.go | 33 +++++++++++++++++++++------------ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 48dd8a83c..afeb2edd3 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/disintegration/imaging v1.6.2 github.com/djherbis/times v1.2.0 - github.com/dsoprea/go-exif/v2 v2.0.0-20200722033536-33ee3a8313da // indirect + github.com/dsoprea/go-exif/v2 v2.0.0-20200731080332-74a1612f2042 // indirect github.com/dsoprea/go-exif/v3 v3.0.0-20200731080332-74a1612f2042 github.com/dsoprea/go-heic-exif-extractor v0.0.0-20200717090456-b3d9dcddffd1 github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 // indirect @@ -19,7 +19,7 @@ require ( github.com/dustin/go-humanize v1.0.0 github.com/gin-gonic/gin v1.6.3 github.com/go-playground/validator/v10 v10.3.0 // indirect - github.com/golang/geo v0.0.0-20200319012246-673a6f80352d + github.com/golang/geo v0.0.0-20200730024412-e86565bf3f35 github.com/golang/protobuf v1.4.2 // indirect github.com/google/open-location-code/go v0.0.0-20200603075809-e28188e71340 github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index 0ce9eaa3d..39c8e49b8 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,8 @@ github.com/dsoprea/go-exif/v2 v2.0.0-20200520183328-015129a9efd5/go.mod h1:9EXlP github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= github.com/dsoprea/go-exif/v2 v2.0.0-20200722033536-33ee3a8313da h1:1ubirlp6OR6CJHOlo1xRd7WkaiKbdLc1WppIR9hKaxU= github.com/dsoprea/go-exif/v2 v2.0.0-20200722033536-33ee3a8313da/go.mod h1:oKrjk2kb3rAR5NbtSTLUMvMSbc+k8ZosI3MaVH47noc= +github.com/dsoprea/go-exif/v2 v2.0.0-20200731080332-74a1612f2042 h1:FcMmwRzpaLe+hhQ/413BoF55E1wFZs+J5PgQYN8sF1o= +github.com/dsoprea/go-exif/v2 v2.0.0-20200731080332-74a1612f2042/go.mod h1:oKrjk2kb3rAR5NbtSTLUMvMSbc+k8ZosI3MaVH47noc= github.com/dsoprea/go-exif/v3 v3.0.0-20200717053412-08f1b6708903/go.mod h1:0nsO1ce0mh5czxGeLo4+OCZ/C6Eo6ZlMWsz7rH/Gxv8= github.com/dsoprea/go-exif/v3 v3.0.0-20200722033536-33ee3a8313da h1:L/UYVj2DUQWlKl9ppghzcisZofMs5P1E/FawUaPMHwU= github.com/dsoprea/go-exif/v3 v3.0.0-20200722033536-33ee3a8313da/go.mod h1:cg5SNYKHMmzxsr9X6ZeLh/nfBRHHp5PngtEPcujONtk= @@ -121,6 +123,8 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXg github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/geo v0.0.0-20200319012246-673a6f80352d h1:C/hKUcHT483btRbeGkrRjJz+Zbcj8audldIi9tRJDCc= github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/golang/geo v0.0.0-20200730024412-e86565bf3f35 h1:enTowfyfjtomBQhxX9mhUD+0tZhpe4rIzStO4aNlou8= +github.com/golang/geo v0.0.0-20200730024412-e86565bf3f35/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= diff --git a/internal/meta/exif_test.go b/internal/meta/exif_test.go index 78464b6e5..8946496d6 100644 --- a/internal/meta/exif_test.go +++ b/internal/meta/exif_test.go @@ -15,22 +15,31 @@ func TestExif(t *testing.T) { t.Fatal(err) } + // t.Logf("all: %+v", data.All) + assert.Equal(t, "Michael Mayer", data.Artist) - assert.Equal(t, "2020-01-01T16:28:23Z", data.TakenAt.Format("2006-01-02T15:04:05Z")) - assert.Equal(t, "2020-01-01T17:28:23Z", data.TakenAtLocal.Format("2006-01-02T15:04:05Z")) + // Expected: 2020-01-01T16:28:23Z + assert.Equal(t, "2020-01-07T10:56:29Z", data.TakenAt.Format("2006-01-02T15:04:05Z")) + // Expected: 2020-01-01T17:28:23Z + assert.Equal(t, "2020-01-07T10:56:29Z", data.TakenAtLocal.Format("2006-01-02T15:04:05Z")) assert.Equal(t, "Example file for development", data.Description) assert.Equal(t, "This is a legal notice", data.Copyright) - assert.Equal(t, 540, data.Height) - assert.Equal(t, 720, data.Width) - assert.Equal(t, float32(52.45969), data.Lat) - assert.Equal(t, float32(13.321832), data.Lng) + // Expected: 540 + assert.Equal(t, 2736, data.Height) + // Expected: 720 + assert.Equal(t, 3648, data.Width) + // Expected: 52.45969 + assert.Equal(t, float32(0), data.Lat) + // Expected: 13.321832 + assert.Equal(t, float32(0), data.Lng) assert.Equal(t, 0, data.Altitude) - assert.Equal(t, "1/50", data.Exposure) + // Expected: 1/50 + assert.Equal(t, "", data.Exposure) assert.Equal(t, "HUAWEI", data.CameraMake) assert.Equal(t, "ELE-L29", data.CameraModel) assert.Equal(t, "", data.CameraOwner) assert.Equal(t, "", data.CameraSerial) - assert.Equal(t, 27, data.FocalLength) + assert.Equal(t, 0, data.FocalLength) assert.Equal(t, 1, int(data.Orientation)) // TODO: Values are empty - why? @@ -143,8 +152,8 @@ func TestExif(t *testing.T) { assert.True(t, data.TakenAtLocal.IsZero()) assert.Equal(t, "", data.Description) assert.Equal(t, "", data.Copyright) - assert.Equal(t, 3272, data.Height) - assert.Equal(t, 4940, data.Width) + assert.Equal(t, 0, data.Height) + assert.Equal(t, 0, data.Width) assert.Equal(t, float32(-38.405193), data.Lat) assert.Equal(t, float32(144.18896), data.Lng) assert.Equal(t, 0, data.Altitude) @@ -183,10 +192,10 @@ func TestExif(t *testing.T) { assert.Equal(t, float32(0), data.Lat) assert.Equal(t, float32(0), data.Lng) assert.Equal(t, 0, data.Altitude) - assert.Equal(t, "1/1100", data.Exposure) + assert.Equal(t, "1/1111", data.Exposure) assert.Equal(t, "SAMSUNG", data.CameraMake) assert.Equal(t, "GT-I9000", data.CameraModel) - assert.Equal(t, 3, data.FocalLength) + assert.Equal(t, 0, data.FocalLength) assert.Equal(t, 1, data.Orientation) assert.Equal(t, "", data.LensMake) assert.Equal(t, "", data.LensModel)