summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-10-18 08:38:32 (GMT)
committerEarl Ou <shunhsingou@google.com>2012-10-18 08:38:32 (GMT)
commit5be98ed60daac27a7d99fe89b9ed4709bfb218aa (patch)
tree6f1b5cd288bad0c5556522127098927610b1d30f /tests
parent144dc616219e088680c267ae6a0463364b33c41d (diff)
downloadandroid_packages_apps_Snap-5be98ed60daac27a7d99fe89b9ed4709bfb218aa.zip
android_packages_apps_Snap-5be98ed60daac27a7d99fe89b9ed4709bfb218aa.tar.gz
android_packages_apps_Snap-5be98ed60daac27a7d99fe89b9ed4709bfb218aa.tar.bz2
use NO_VALUE when the output of exiftool is invalid
Change-Id: I85c0054d70ff1639e643a30658ca59f1803f7d13
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 5de54a3..7df23f1 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>")