summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2012-11-12 22:16:14 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-12 22:16:14 -0800
commit201c6d506889bf617010d1f8dfac6fe09a0d982a (patch)
treee3342e86f0f6c5467932b2ef996684c77cba5d0e /tests
parentf0d2bbed7be5bcce498eee554a3809a7ce785464 (diff)
parent0ffdd632e3739db5c0389840d410fa95afd59f88 (diff)
downloadandroid_packages_apps_Gallery2-201c6d506889bf617010d1f8dfac6fe09a0d982a.tar.gz
android_packages_apps_Gallery2-201c6d506889bf617010d1f8dfac6fe09a0d982a.tar.bz2
android_packages_apps_Gallery2-201c6d506889bf617010d1f8dfac6fe09a0d982a.zip
Merge "use NO_VALUE when the output of exiftool is invalid" into gb-ub-photos-bryce
Diffstat (limited to 'tests')
-rwxr-xr-xtests/exiftool_parser/parser.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/exiftool_parser/parser.py b/tests/exiftool_parser/parser.py
index 5de54a352..7df23f154 100755
--- a/tests/exiftool_parser/parser.py
+++ b/tests/exiftool_parser/parser.py
@@ -33,7 +33,7 @@ print "<exif>"
# | | | + [xxx directory with xx entries]
#
p = re.compile(
- "(((?:\| )+)[0-9]*\).*? = .*?\n.*?- Tag 0x[0-9a-f]{4})" + "|"
+ "(((?:\| )+)[0-9]*\)(?:(?:.*? = .*?)|(?:.*? \(SubDirectory\) -->))\n.*?- Tag 0x[0-9a-f]{4})" + "|"
+ "(((?:\| )*)\+ \[.*? directory with [0-9]+ entries]$)"
, re.M)
tags = p.findall(text)
@@ -68,16 +68,22 @@ for s in tags:
_id = _id.group(0)
# find the name
- name = re.search("[0-9]*?\).*? = ", s)
- name = name.group(0)[4:-3]
+ name = re.search("[0-9]*?\).*?(?:(?: = )|(?: \(SubDirectory\) -->))", s)
+ name = name.group(0).split()[1]
# find the raw value in the parenthesis
- value = re.search("\(.*\)\n", s)
- if (name != 'Model' and value):
- value = value.group(0)[1:-2]
+ value = re.search("\(SubDirectory\) -->", s)
+ if value:
+ value = "NO_VALUE"
else:
- value = re.search("=.*\n", s)
- value = value.group(0)[2:-1]
+ value = re.search("\(.*\)\n", s)
+ if (name != 'Model' and value):
+ value = value.group(0)[1:-2]
+ else:
+ value = re.search("=.*\n", s)
+ value = value.group(0)[2:-1]
+ if "[snip]" in value:
+ value = "NO_VALUE"
print (' <tag ifd="' + ifds[-1] + '" id="'
+ _id + '" name="' + name +'">' + value + "</tag>")