From 1de9270ded0db955e309a21b8abc8981237fbc52 Mon Sep 17 00:00:00 2001 From: Julien Valroff Date: Sat, 3 Jul 2010 16:56:43 +0200 Subject: Imported Upstream version 0.2.3 --- rapid/metadata.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'rapid/metadata.py') 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): -- cgit v1.2.3