~vladh/fotografiska2

ea5dc9cec4a11de0d84e2c400c025d82430c0040 — Vlad-Stefan Harbuz 1 year, 10 months ago f47d728
fix error message and hash formatting bug
1 files changed, 3 insertions(+), 3 deletions(-)

M main.go
M main.go => main.go +3 -3
@@ 90,7 90,7 @@ func getExifCreationTime(path string) (time.Time, error) {
	}

	if offsetStr == "" {
		fmt.Printf("[%s] WARNING: Got DateTimeOriginal but no OffsetTimeOriginal, time will be UTC", path)
		fmt.Printf("\tWARNING: Got DateTimeOriginal but no OffsetTimeOriginal, time will be UTC\n")
		return time.Parse("2006:01:02 15:04:05", dtStr)
	} else {
		return time.Parse("2006:01:02 15:04:05-07:00", dtStr + offsetStr)


@@ 123,7 123,7 @@ func getPhotoHash(path string) string {
	nBytesRead, err := file.Read(bytes)
	if err != nil || nBytesRead == 0 { panic(err) }
	sum := xxhash.Sum64(bytes)
	hash := fmt.Sprintf("%x", sum)
	hash := fmt.Sprintf("%.16x", sum)
	return hash
}



@@ 190,7 190,7 @@ func validateFile(path string) bool {
	}
	hash := parts[1]
	if len(hash) != 16 {
		panic(fmt.Sprintf("Expected the following to be a length 16 hash but it wasn't: %s", hash))
		panic(fmt.Sprintf("Expected the following to be a length 16 hash but it wasn't: %s\nFull path was: %s", hash, path))
	}
	correctHash := getPhotoHash(path)
	return hash == correctHash