Backend: Change titles of unknown photos

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-04-15 14:29:40 +02:00
parent 6941028c4f
commit 1f2c0171b1

View file

@ -222,19 +222,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
if len(labels) > 0 && labels[0].Priority >= -1 && labels[0].Uncertainty <= 85 && labels[0].Name != "" {
photo.PhotoTitle = fmt.Sprintf("%s / %s", txt.Title(labels[0].Name), m.DateCreated().Format("2006"))
} else if !photo.TakenAtLocal.IsZero() {
var daytimeString string
hour := photo.TakenAtLocal.Hour()
switch {
case hour < 17:
daytimeString = "Unknown"
case hour < 20:
daytimeString = "Sunset"
default:
daytimeString = "Unknown"
}
photo.PhotoTitle = fmt.Sprintf("%s / %s", daytimeString, photo.TakenAtLocal.Format("2006"))
photo.PhotoTitle = fmt.Sprintf("Unknown / %s", photo.TakenAtLocal.Format("2006"))
} else {
photo.PhotoTitle = "Unknown"
}