Metadata: Upgrade go-exif v2
See https://github.com/dsoprea/go-exif/issues/43 Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
08d89bfb1d
commit
4c72df7610
4 changed files with 12 additions and 9 deletions
2
go.mod
2
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-20200711182015-0758712be348
|
||||
github.com/dsoprea/go-exif/v2 v2.0.0-20200717063959-46b1a0cd1772
|
||||
github.com/dsoprea/go-heic-exif-extractor v0.0.0-20200520190950-3ae4ff88a0d1
|
||||
github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 // indirect
|
||||
github.com/dsoprea/go-jpeg-image-structure v0.0.0-20200615034914-d40a386309d2
|
||||
|
|
2
go.sum
2
go.sum
|
@ -52,6 +52,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-20200711182015-0758712be348 h1:QRIs9an+oFvcpJOUq4CJdYUOMrZJtAz0M32YHIbwkDc=
|
||||
github.com/dsoprea/go-exif/v2 v2.0.0-20200711182015-0758712be348/go.mod h1:oKrjk2kb3rAR5NbtSTLUMvMSbc+k8ZosI3MaVH47noc=
|
||||
github.com/dsoprea/go-exif/v2 v2.0.0-20200717063959-46b1a0cd1772 h1:M49UNOTa5sLju107lAoMsm93B/fHD02vWIoskmXMBm8=
|
||||
github.com/dsoprea/go-exif/v2 v2.0.0-20200717063959-46b1a0cd1772/go.mod h1:oKrjk2kb3rAR5NbtSTLUMvMSbc+k8ZosI3MaVH47noc=
|
||||
github.com/dsoprea/go-heic-exif-extractor v0.0.0-20200520190950-3ae4ff88a0d1 h1:8Tbo+OYgg7i2G3fltmpWq1if1e752aMX7Zv/sNWWJUk=
|
||||
github.com/dsoprea/go-heic-exif-extractor v0.0.0-20200520190950-3ae4ff88a0d1/go.mod h1:UwRKreeVikXn5OarSnt4OqovcEjsIgZVuc5svj7G5w4=
|
||||
github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb h1:gwjJjUr6FY7zAWVEueFPrcRHhd9+IK81TcItbqw2du4=
|
||||
|
|
|
@ -274,10 +274,10 @@ func TestExif(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Equal(t, "2020-06-16T18:52:46Z", data.TakenAt.Format("2006-01-02T15:04:05Z"))
|
||||
assert.Equal(t, "2020-06-16T16:52:46Z", data.TakenAt.Format("2006-01-02T15:04:05Z"))
|
||||
assert.Equal(t, "2020-06-16T18:52:46Z", data.TakenAtLocal.Format("2006-01-02T15:04:05Z"))
|
||||
assert.Equal(t, float32(0), data.Lat)
|
||||
assert.Equal(t, float32(0), data.Lng)
|
||||
assert.Equal(t, float32(48.302776), data.Lat)
|
||||
assert.Equal(t, float32(8.9275), data.Lng)
|
||||
assert.Equal(t, 0, data.Altitude)
|
||||
assert.Equal(t, "1/110", data.Exposure)
|
||||
assert.Equal(t, "HUAWEI", data.CameraMake)
|
||||
|
@ -298,7 +298,7 @@ func TestExif(t *testing.T) {
|
|||
// t.Logf("all: %+v", data.All)
|
||||
|
||||
assert.Equal(t, "", data.Artist)
|
||||
assert.Equal(t, "2020-05-24T11:55:21Z", data.TakenAt.Format("2006-01-02T15:04:05Z"))
|
||||
assert.Equal(t, "2020-05-24T08:55:21Z", data.TakenAt.Format("2006-01-02T15:04:05Z"))
|
||||
assert.Equal(t, "2020-05-24T11:55:21Z", data.TakenAtLocal.Format("2006-01-02T15:04:05Z"))
|
||||
assert.Equal(t, "", data.Title)
|
||||
assert.Equal(t, "", data.Keywords)
|
||||
|
@ -306,8 +306,8 @@ func TestExif(t *testing.T) {
|
|||
assert.Equal(t, "", data.Copyright)
|
||||
assert.Equal(t, 3600, data.Height)
|
||||
assert.Equal(t, 7200, data.Width)
|
||||
assert.Equal(t, float32(0), data.Lat)
|
||||
assert.Equal(t, float32(0), data.Lng)
|
||||
assert.Equal(t, float32(59.84083), data.Lat)
|
||||
assert.Equal(t, float32(30.51), data.Lng)
|
||||
assert.Equal(t, 0, data.Altitude)
|
||||
assert.Equal(t, "1/1250", data.Exposure)
|
||||
assert.Equal(t, "SAMSUNG", data.CameraMake)
|
||||
|
|
|
@ -64,7 +64,7 @@ func GpsToDecimal(s string) float32 {
|
|||
return float32(latDeg.Decimal())
|
||||
}
|
||||
|
||||
// GpsToLng returns a single GPS coordinate value as float point number (degree, minute or second).
|
||||
// GpsToLng returns a single GPS coordinate value as floating point number (degree, minute or second).
|
||||
func GpsCoord(s string) float64 {
|
||||
if s == "" {
|
||||
return 0
|
||||
|
@ -73,7 +73,8 @@ func GpsCoord(s string) float64 {
|
|||
result, err := strconv.ParseFloat(s, 64)
|
||||
|
||||
if err != nil {
|
||||
log.Debugf("metadata: %s", err)
|
||||
log.Debugf("metadata: invalid floating-point number '%s' (gps coord)", s)
|
||||
return 0
|
||||
}
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in a new issue