deal with bad exif
This commit is contained in:
parent
2bb3b1a318
commit
a468db2585
8
main.go
8
main.go
@ -184,7 +184,7 @@ func parse(in <-chan string) <-chan file {
|
|||||||
case notMedia:
|
case notMedia:
|
||||||
log.Printf("%+v", err)
|
log.Printf("%+v", err)
|
||||||
default:
|
default:
|
||||||
log.Printf("%+v", err)
|
log.Printf("parse error: %+v", err)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
@ -222,8 +222,10 @@ func _parse(path string) (file, error) {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
x, err := exif.Decode(f)
|
x, err := exif.Decode(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: sometimes valid jpgs have bad exif data (issue #1)
|
if exif.IsCriticalError(err) {
|
||||||
return nil, notMedia{path}
|
return nil, notMedia{path}
|
||||||
|
}
|
||||||
|
log.Printf("%q: exif.Decode, warning: %v", path, err)
|
||||||
}
|
}
|
||||||
tm, err := x.DateTime()
|
tm, err := x.DateTime()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user