summaryrefslogtreecommitdiff
path: root/rapid/metadata.py
diff options
context:
space:
mode:
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):