diff --git a/internal/meta/data.go b/internal/meta/data.go index 353d8d5a0..368e900d2 100644 --- a/internal/meta/data.go +++ b/internal/meta/data.go @@ -6,7 +6,7 @@ import ( // Data represents image meta data. type Data struct { - UUID string + UniqueID string TakenAt time.Time TakenAtLocal time.Time TimeZone string diff --git a/internal/meta/exif.go b/internal/meta/exif.go index 933d50b08..dbb81564d 100644 --- a/internal/meta/exif.go +++ b/internal/meta/exif.go @@ -192,7 +192,7 @@ func Exif(filename string) (data Data, err error) { } if value, ok := tags["ImageUniqueID"]; ok { - data.UUID = value + data.UniqueID = value } if value, ok := tags["ImageWidth"]; ok { diff --git a/internal/photoprism/index_mediafile.go b/internal/photoprism/index_mediafile.go index 98a993600..7390c87c6 100644 --- a/internal/photoprism/index_mediafile.go +++ b/internal/photoprism/index_mediafile.go @@ -104,10 +104,10 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions) IndexResult { photo.PhotoAltitude = metaData.Altitude photo.PhotoArtist = metaData.Artist - if len(metaData.UUID) > 15 { - log.Debugf("index: file uuid \"%s\"", metaData.UUID) + if len(metaData.UniqueID) > 15 { + log.Debugf("index: file uuid \"%s\"", metaData.UniqueID) - file.FileUUID = metaData.UUID + file.FileUUID = metaData.UniqueID } } } diff --git a/internal/photoprism/metadata_test.go b/internal/photoprism/metadata_test.go index fddb265c4..61c8b46f1 100644 --- a/internal/photoprism/metadata_test.go +++ b/internal/photoprism/metadata_test.go @@ -23,7 +23,7 @@ func TestMediaFile_Exif_JPEG(t *testing.T) { assert.IsType(t, meta.Data{}, info) - assert.Equal(t, "", info.UUID) + assert.Equal(t, "", info.UniqueID) assert.Equal(t, "2013-11-26 13:53:55 +0000 UTC", info.TakenAt.String()) assert.Equal(t, "2013-11-26 15:53:55 +0000 UTC", info.TakenAtLocal.String()) assert.Equal(t, 1, info.Orientation) @@ -60,7 +60,7 @@ func TestMediaFile_Exif_JPEG(t *testing.T) { assert.IsType(t, meta.Data{}, info) - assert.Equal(t, "", info.UUID) + assert.Equal(t, "", info.UniqueID) assert.Equal(t, 1, info.Orientation) assert.Equal(t, "Canon EOS 7D", info.CameraModel) assert.Equal(t, "Canon", info.CameraMake) @@ -100,7 +100,7 @@ func TestMediaFile_Exif_DNG(t *testing.T) { assert.IsType(t, meta.Data{}, info) - assert.Equal(t, "", info.UUID) + assert.Equal(t, "", info.UniqueID) assert.Equal(t, "2019-06-06 07:29:51 +0000 UTC", info.TakenAt.String()) assert.Equal(t, "2019-06-06 07:29:51 +0000 UTC", info.TakenAtLocal.String()) assert.Equal(t, 1, info.Orientation) @@ -150,7 +150,7 @@ func TestMediaFile_Exif_HEIF(t *testing.T) { assert.Nil(t, err) - assert.Equal(t, "", jpegInfo.UUID) + assert.Equal(t, "", jpegInfo.UniqueID) assert.Equal(t, "2018-09-10 03:16:13 +0000 UTC", jpegInfo.TakenAt.String()) assert.Equal(t, "2018-09-10 12:16:13 +0000 UTC", jpegInfo.TakenAtLocal.String()) assert.Equal(t, 6, jpegInfo.Orientation) diff --git a/pkg/rnd/ppid.go b/pkg/rnd/ppid.go index c5dd0b930..571c9d727 100644 --- a/pkg/rnd/ppid.go +++ b/pkg/rnd/ppid.go @@ -7,10 +7,10 @@ import ( // PPID returns a unique id with prefix as string. func PPID(prefix rune) string { - result := make([]byte, 0, 17) + result := make([]byte, 0, 16) result = append(result, byte(prefix)) result = append(result, strconv.FormatInt(time.Now().UTC().Unix(), 36)[0:6]...) - result = append(result, Token(10)...) + result = append(result, Token(9)...) return string(result) } diff --git a/pkg/rnd/token_test.go b/pkg/rnd/token_test.go index 54e2b6fbf..741c0bf3d 100644 --- a/pkg/rnd/token_test.go +++ b/pkg/rnd/token_test.go @@ -59,7 +59,7 @@ func TestPPID(t *testing.T) { for n := 0; n < 5; n++ { uuid := PPID('x') t.Logf("id: %s", uuid) - assert.Equal(t, len(uuid), 17) + assert.Equal(t, len(uuid), 16) } }