From 63e12cff115471add419b787c86e12575a8b306c Mon Sep 17 00:00:00 2001 From: JackDandy Date: Sun, 6 Nov 2016 04:05:01 +0000 Subject: [PATCH] Change improve fault tolerance of Hachoir jpeg parser. Ignore fields not required for GPS tag parsing. --- CHANGES.md | 1 + HACKS.txt | 1 + lib/hachoir_metadata/jpeg.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0ed8fdaf..88e5390d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -180,6 +180,7 @@ * Fix never set episodes without airdate to wanted * Change improve getting the local timezone information * Change hachoir_parser to close input stream if no parser is found e.g. due to file corruption +* Change improve fault tolerance of Hachoir jpeg parser * Change reduce time taken to parse avi RIFF metadata during post processing and other times * Change avi metadata extraction is more fault tolerant and the chance of hanging due to corrupt avi files is reduced * Change fuzzyMoment to handle air dates before ~1970 on display show page diff --git a/HACKS.txt b/HACKS.txt index 4117a074..db0f4cfa 100644 --- a/HACKS.txt +++ b/HACKS.txt @@ -4,6 +4,7 @@ Libs with customisations... /lib/dateutil/zoneinfo/__init__.py /lib/hachoir_core/config.py /lib/hachoir_core/stream/input_helpers.py +/lib/hachoir_metadata/jpeg.py /lib/hachoir_metadata/metadata.py /lib/hachoir_metadata/riff.py /lib/hachoir_parser/guess.py diff --git a/lib/hachoir_metadata/jpeg.py b/lib/hachoir_metadata/jpeg.py index 9e951672..6f36dd7d 100644 --- a/lib/hachoir_metadata/jpeg.py +++ b/lib/hachoir_metadata/jpeg.py @@ -210,6 +210,10 @@ class JpegMetadata(RootMetadata): datestamp = None for entry in ifd.array("entry"): tag = entry["tag"].display + if tag not in ["GPSLatitudeRef", "GPSLongitudeRef","GPSAltitudeRef", + "GPSLatitude", "GPSLongitude", "GPSAltitude", + "GPSDateStamp", "GPSTimeStamp"]: + continue values = [v.value for v in ifd.getEntryValues(entry)] if tag == "GPSLatitudeRef": if values[0] == "N":