Metadata: Limit Exif extraction to photos #338
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
9a5d4fa719
commit
e775c8f910
1 changed files with 8 additions and 1 deletions
|
@ -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())))
|
||||
|
|
Loading…
Reference in a new issue