Backend: Index file error messages

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-20 11:39:16 +02:00
parent 9a2b75781e
commit 8ebb6b85ed
2 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import (
// Colors returns the ColorPerception of an image (only JPEG supported).
func (m *MediaFile) Colors(thumbPath string) (perception colors.ColorPerception, err error) {
if !m.IsJpeg() {
return perception, fmt.Errorf("colors: %s is not a jpeg", txt.Quote(m.BaseName()))
return perception, fmt.Errorf("%s is not a jpeg", txt.Quote(m.BaseName()))
}
img, err := m.Resample(thumbPath, "colors")

View File

@ -194,6 +194,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
photo.PhotoPath = filePath
photo.PhotoName = fileBase
file.FileError = ""
if !file.FilePrimary {
if photoExists {
@ -228,6 +229,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
// Color information
if p, err := m.Colors(Config().ThumbPath()); err != nil {
log.Errorf("index: %s in %s (detect colors)", err.Error(), logName)
file.FileError = err.Error()
} else {
file.FileMainColor = p.MainColor.Name()
file.FileColors = p.Colors.Hex()
@ -415,7 +417,6 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
// file obviously exists: remove deleted and missing flags
file.DeletedAt = nil
file.FileMissing = false
file.FileError = ""
// primary files are used for rendering thumbnails and image classification (plus sidecar files if they exist)
if file.FilePrimary {