Backend: Skip archived photos while indexing #300

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-05-11 08:57:58 +02:00
parent 78d1230088
commit 4fbed12e94
4 changed files with 40 additions and 32 deletions

View file

@ -24,6 +24,7 @@ const (
IndexAdded IndexStatus = "added"
IndexSkipped IndexStatus = "skipped"
IndexDuplicate IndexStatus = "skipped duplicate"
IndexArchived IndexStatus = "skipped archived"
IndexFailed IndexStatus = "failed"
)
@ -144,6 +145,16 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
}
}
if photo.PhotoQuality == -1 && file.FilePrimary {
// restore photos that have been purged automatically
photo.DeletedAt = nil
} else if photo.DeletedAt != nil {
result.Status = IndexArchived
return result
}
file.DeletedAt = nil
if file.FilePrimary {
primaryFile = file
@ -296,9 +307,6 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
}
}
photo.DeletedAt = nil
file.DeletedAt = nil
if photoExists {
// Estimate location
if o.Rescan && photo.NoLocation() {