Metadata: Limit Exif extraction to photos #338

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-05-29 18:14:43 +02:00
parent 9a5d4fa719
commit e775c8f910

View file

@ -1,6 +1,7 @@
package photoprism
import (
"errors"
"path/filepath"
"github.com/photoprism/photoprism/internal/meta"
@ -11,7 +12,13 @@ import (
// MetaData returns exif meta data of a media file.
func (m *MediaFile) MetaData() (result meta.Data) {
m.metaDataOnce.Do(func() {
err := m.metaData.Exif(m.FileName())
var err error
if m.IsPhoto() {
err = m.metaData.Exif(m.FileName())
} else {
err = errors.New("not a photo")
}
if jsonFile := fs.TypeJson.FindSub(m.FileName(), fs.HiddenPath, false); jsonFile == "" {
log.Debugf("mediafile: no json sidecar file found for %s", txt.Quote(filepath.Base(m.FileName())))