From 54c8a25ff86eaab4f8e288c4ef46213eaf62a4d9 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Mon, 20 Jul 2020 12:32:50 +0200 Subject: [PATCH] Index: Also compare camera serial before stacking a file Signed-off-by: Michael Mayer --- internal/photoprism/index_mediafile.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/photoprism/index_mediafile.go b/internal/photoprism/index_mediafile.go index 4fd673e8b..dcc58348c 100644 --- a/internal/photoprism/index_mediafile.go +++ b/internal/photoprism/index_mediafile.go @@ -102,7 +102,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) ( fileHash := "" fileChanged := true fileExists := false - fileGrouped := false + fileStacked := false photoExists := false @@ -140,10 +140,10 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) ( if photoQuery.Error != nil && m.MetaData().HasTimeAndPlace() { metaData = m.MetaData() - photoQuery = entity.UnscopedDb().First(&photo, "photo_lat = ? AND photo_lng = ? AND taken_at = ?", metaData.Lat, metaData.Lng, metaData.TakenAt) + photoQuery = entity.UnscopedDb().First(&photo, "photo_lat = ? AND photo_lng = ? AND taken_at = ? AND camera_serial = ?", metaData.Lat, metaData.Lng, metaData.TakenAt, metaData.CameraSerial) if photoQuery.Error == nil { - fileGrouped = true + fileStacked = true } } @@ -151,7 +151,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) ( photoQuery = entity.UnscopedDb().First(&photo, "uuid = ?", m.MetaData().DocumentID) if photoQuery.Error == nil { - fileGrouped = true + fileStacked = true } } } else { @@ -662,7 +662,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) ( "count": 1, }) - if fileGrouped { + if fileStacked { result.Status = IndexStacked } else { result.Status = IndexAdded