simple tool to de-duplicate and arrange media.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
394 B

package arrange
import (
"fmt"
"io"
"time"
"github.com/rwcarlsen/goexif/exif"
)
func parseExif(f io.Reader) (time.Time, error) {
ti := time.Time{}
x, err := exif.Decode(f)
if err != nil {
if exif.IsCriticalError(err) {
return ti, err
}
}
tm, err := x.DateTime()
if err != nil {
return ti, fmt.Errorf("no datetime in an ostensibly valid exif %v", err)
}
return tm, nil
}