deal with bad exif

This commit is contained in:
Stephen McQuay 2016-05-17 19:38:08 -07:00
parent 2bb3b1a318
commit a468db2585
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

View File

@ -184,7 +184,7 @@ func parse(in <-chan string) <-chan file {
case notMedia:
log.Printf("%+v", err)
default:
log.Printf("%+v", err)
log.Printf("parse error: %+v", err)
}
continue
} else {
@ -222,9 +222,11 @@ func _parse(path string) (file, error) {
defer f.Close()
x, err := exif.Decode(f)
if err != nil {
// TODO: sometimes valid jpgs have bad exif data (issue #1)
if exif.IsCriticalError(err) {
return nil, notMedia{path}
}
log.Printf("%q: exif.Decode, warning: %v", path, err)
}
tm, err := x.DateTime()
if err != nil {
return nil, fmt.Errorf("problem getting datetime from pic %v: %v", path, err)