summaryrefslogtreecommitdiff
path: root/rapid/metadataphoto.py
diff options
context:
space:
mode:
authorJulien Valroff <julien@kirya.net>2012-01-08 07:54:46 +0100
committerJulien Valroff <julien@kirya.net>2012-01-08 07:54:46 +0100
commit05e7b52a1f94a40996f2619ad9db8bbdb1518497 (patch)
treef63dbaaf571e59a139ddf3de2a3103965e8093aa /rapid/metadataphoto.py
parentda2cce92a7eed706d04d6cbe778fd1bf32f18eeb (diff)
Imported Upstream version 0.4.3upstream/0.4.3
Diffstat (limited to 'rapid/metadataphoto.py')
-rw-r--r--[-rwxr-xr-x]rapid/metadataphoto.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/rapid/metadataphoto.py b/rapid/metadataphoto.py
index 0442a86..1b36be9 100755..100644
--- a/rapid/metadataphoto.py
+++ b/rapid/metadataphoto.py
@@ -30,7 +30,7 @@ except ImportError:
sys.stderr.write("You need to install pyexiv2, the python binding for exiv2, to run this program.\n" )
sys.exit(1)
-
+import metadataexiftool
def __version_info(version):
if not version:
@@ -39,7 +39,7 @@ def __version_info(version):
v = ''
for i in version:
v += '.%s' % i
- return v[1:]
+ return v[1:]
def pyexiv2_version_info():
return __version_info(pyexiv2.version_info)
@@ -54,6 +54,16 @@ class MetaData(pyexiv2.metadata.ImageMetadata):
"""
+ def __init__(self, full_file_name):
+ pyexiv2.metadata.ImageMetadata.__init__(self, full_file_name)
+ self.rpd_metadata_exiftool = None
+ self.rpd_full_file_name = full_file_name
+
+ def _load_exiftool(self):
+ if self.rpd_metadata_exiftool is None:
+ self.rpd_metadata_exiftool = metadataexiftool.ExifToolMetaData(self.rpd_full_file_name)
+
+
def aperture(self, missing=''):
"""
Returns in string format the floating point value of the image's aperture.
@@ -211,6 +221,19 @@ class MetaData(pyexiv2.metadata.ImageMetadata):
except:
return missing
+ def file_number(self, missing=''):
+ """returns Exif.CanonFi.FileNumber, not to be confused with
+ Exif.Canon.FileNumber"""
+ try:
+ if 'Exif.CanonFi.FileNumber' in self.exif_keys:
+ self._load_exiftool()
+ return self.rpd_metadata_exiftool.file_number(missing)
+ else:
+ return missing
+ except:
+ return missing
+
+
def owner_name(self, missing=''):
""" returns camera name recorded by select Canon cameras"""
try: