diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-02-25 09:59:32 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-02-25 09:59:32 +0100 |
commit | 07b77b0d18d9c7c90e89804791d5d78dc13017e6 (patch) | |
tree | f94eed42f7e25805d1bc151f8ac586ea61d821fa /src/pyexiv2.py | |
parent | 87e717129934903f87048db77cab9fd0b440757c (diff) | |
download | pyexiv2-07b77b0d18d9c7c90e89804791d5d78dc13017e6.tar.gz |
IPTC Time to string conversion.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index d3814e1..90ef36e 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -561,6 +561,17 @@ class IptcTag(MetadataTag): else: raise IptcValueError(value, xtype) + elif xtype == 'Time': + if type(value) in (datetime.time, datetime.datetime): + r = value.strftime('%H%M%S') + if value.tzinfo is not None: + r += value.strftime('%z') + else: + r += '+0000' + return r + else: + raise IptcValueError(value, xtype) + # TODO: other types raise IptcValueError(value, xtype) |