diff options
author | Antoine Beaupré <anarcat@debian.org> | 2018-03-14 12:24:17 -0400 |
---|---|---|
committer | Antoine Beaupré <anarcat@debian.org> | 2018-03-14 12:24:17 -0400 |
commit | 0a297829eaf3912c939e1b43a3ef6ddeb7607b38 (patch) | |
tree | 51733e0d6ffb00f0f7dfe01dccd48b2a598e5153 /raphodo/metadataphoto.py | |
parent | 88c8bd4cd2ee4707f8a43be4d89c4e040dcced2f (diff) |
New upstream version 0.9.9upstream/0.9.9
Diffstat (limited to 'raphodo/metadataphoto.py')
-rwxr-xr-x | raphodo/metadataphoto.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/raphodo/metadataphoto.py b/raphodo/metadataphoto.py index 4989c60..b71f375 100755 --- a/raphodo/metadataphoto.py +++ b/raphodo/metadataphoto.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (C) 2007-2017 Damon Lynch <damonlynch@gmail.com> +# Copyright (C) 2007-2018 Damon Lynch <damonlynch@gmail.com> # This file is part of Rapid Photo Downloader. # @@ -20,7 +20,7 @@ # see <http://www.gnu.org/licenses/>. __author__ = 'Damon Lynch' -__copyright__ = "Copyright 2007-2017, Damon Lynch" +__copyright__ = "Copyright 2007-2018, Damon Lynch" import re import datetime @@ -264,7 +264,19 @@ class MetaData(GExiv2.Metadata): return self._fetch_vendor(VENDOR_SERIAL_CODES, missing) def shutter_count(self, missing=''): - return self._fetch_vendor(VENDOR_SHUTTER_COUNT, missing) + shutter = self._fetch_vendor(VENDOR_SHUTTER_COUNT, missing) + if shutter != missing: + return shutter + + if self.camera_make().lower() == 'sony': + try: + ic = self.et_process.get_tags(['ImageCount'], self.rpd_full_file_name) + except (ValueError, TypeError): + return missing + if ic: + return ic['ImageCount'] + + return missing def file_number(self, missing=''): """ @@ -280,8 +292,7 @@ class MetaData(GExiv2.Metadata): if 'Exif.CanonFi.FileNumber' in self: assert self.et_process is not None try: - fn = self.et_process.get_tags(['FileNumber'], - self.rpd_full_file_name) + fn = self.et_process.get_tags(['FileNumber'], self.rpd_full_file_name) except (ValueError, TypeError): return missing |