summaryrefslogtreecommitdiff
path: root/rapid/metadata.py
diff options
context:
space:
mode:
authorJulien Valroff <julien@kirya.net>2010-07-03 16:56:43 +0200
committerJulien Valroff <julien@kirya.net>2010-07-03 16:56:43 +0200
commit1de9270ded0db955e309a21b8abc8981237fbc52 (patch)
treef5b7126171b4d263ea493bff9158758ea36d1047 /rapid/metadata.py
parentf49f82b74596eda33ee5e2fc14e51fd67351b9ec (diff)
Imported Upstream version 0.2.3upstream/0.2.3
Diffstat (limited to 'rapid/metadata.py')
-rwxr-xr-xrapid/metadata.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/rapid/metadata.py b/rapid/metadata.py
index f8886d7..c116072 100755
--- a/rapid/metadata.py
+++ b/rapid/metadata.py
@@ -98,17 +98,18 @@ RAW_FILE_EXTENSIONS = ['arw', 'dcr', 'cr2', 'crw', 'dng', 'mos', 'mrw',
#RW2 files, so we should not read those! exiv2 0.17 & pyexiv2 segfaults
#with MEF files.
-if exiv2_version[0] > 0:
- RAW_FILE_EXTENSIONS += ['rw2', 'mef']
-else:
- if exiv2_version[1] > 17:
- RAW_FILE_EXTENSIONS += ['mef']
- if exiv2_version[1] > 18:
- RAW_FILE_EXTENSIONS += ['rw2']
+if exiv2_version is not None:
+ if exiv2_version[0] > 0:
+ RAW_FILE_EXTENSIONS += ['rw2', 'mef']
else:
- if len(exiv2_version) > 2:
- if exiv2_version[2] >= 1:
- RAW_FILE_EXTENSIONS += ['rw2']
+ if exiv2_version[1] > 17:
+ RAW_FILE_EXTENSIONS += ['mef']
+ if exiv2_version[1] > 18:
+ RAW_FILE_EXTENSIONS += ['rw2']
+ else:
+ if len(exiv2_version) > 2:
+ if exiv2_version[2] >= 1:
+ RAW_FILE_EXTENSIONS += ['rw2']
RAW_FILE_EXTENSIONS.sort()
@@ -455,10 +456,13 @@ class MetaData(baseclass):
def __getitem__(self, key):
if self.__version01__:
- return pyexiv2.Image.__getitem__(self, key)
+ v = pyexiv2.Image.__getitem__(self, key)
else:
- return pyexiv2.metadata.ImageMetadata.__getitem__(self, key).raw_value
-
+ v = pyexiv2.metadata.ImageMetadata.__getitem__(self, key).raw_value
+ # strip out null bytes from strings
+ if isinstance(v, types.StringType):
+ v = v.replace('\x00', '')
+ return v
class DummyMetaData(MetaData):