eggification
[Photo.git] / Products / Photo / standards / exif / _exif_tags.py
diff --git a/Products/Photo/standards/exif/_exif_tags.py b/Products/Photo/standards/exif/_exif_tags.py
new file mode 100755 (executable)
index 0000000..ea0f211
--- /dev/null
@@ -0,0 +1,43 @@
+""" Exif tags based on JEITA CP-3451 Exif Version 2.2 specification tables.
+
+
+
+"""
+from os.path import join
+from Globals import package_home
+home = package_home(globals())
+
+files = [
+#        'gpsA.csv'
+         'ifdA.csv'
+       , 'ifdB.csv'
+       , 'ifdC.csv'
+       , 'ifdD.csv'
+       , 'ifdE.csv'
+       , 'ifdF.csv'
+       , 'ifdG.csv'
+       , 'ifdH.csv'
+       , 'tiffA.csv'
+       , 'tiffB.csv'
+       , 'tiffC.csv'
+       , 'tiffD.csv'
+       , 'hand_added.csv'
+]
+
+
+TAGS = {}
+TAG_TYPES = {}
+
+for name in files :
+       f = file(join(home, name))
+       lines = f.readlines()
+       f.close()
+       for l in [l for l in lines if not l.startswith('#')] :
+               fields = [f.strip() for f in l.split(';')]
+               assert len(fields) == 7, "%s malformed at line: '%s')" % (path, l)
+               tagName, fieldName, tagIdDec, noise, typ, count, noise = fields
+               tagId = int(tagIdDec)
+               if TAGS.has_key(tagId) :
+                       raise ValueError, "%x tag is already defined" % tagId
+               TAGS[tagId] = (fieldName, tagName)
+               TAG_TYPES[tagId] = (typ, count)