luxia--
[Photo.git] / standards / exif / _exif_tags.py
1 """ Exif tags based on JEITA CP-3451 Exif Version 2.2 specification tables.
2
3
4
5 """
6 from os.path import join
7 from Globals import package_home
8 home = package_home(globals())
9
10 files = [
11 # 'gpsA.csv'
12 'ifdA.csv'
13 , 'ifdB.csv'
14 , 'ifdC.csv'
15 , 'ifdD.csv'
16 , 'ifdE.csv'
17 , 'ifdF.csv'
18 , 'ifdG.csv'
19 , 'ifdH.csv'
20 , 'tiffA.csv'
21 , 'tiffB.csv'
22 , 'tiffC.csv'
23 , 'tiffD.csv'
24 , 'hand_added.csv'
25 ]
26
27
28 TAGS = {}
29 TAG_TYPES = {}
30
31 for name in files :
32 f = file(join(home, name))
33 lines = f.readlines()
34 f.close()
35 for l in [l for l in lines if not l.startswith('#')] :
36 fields = [f.strip() for f in l.split(';')]
37 assert len(fields) == 7, "%s malformed at line: '%s')" % (path, l)
38 tagName, fieldName, tagIdDec, noise, typ, count, noise = fields
39 tagId = int(tagIdDec)
40 if TAGS.has_key(tagId) :
41 raise ValueError, "%x tag is already defined" % tagId
42 TAGS[tagId] = (fieldName, tagName)
43 TAG_TYPES[tagId] = (typ, count)