From 38397b507b456169cf3be2d2dc6743ec8653feb3 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sun, 8 Nov 2020 21:17:19 -0800 Subject: [PATCH] Fix for issue #247 --- osxphotos/_version.py | 2 +- osxphotos/photoinfo/_photoinfo_export.py | 7 +++++-- tests/test_cli.py | 4 ++-- tests/test_export_catalina_10_15_7.py | 12 ++++++------ tests/test_export_mojave_10_14_6.py | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/osxphotos/_version.py b/osxphotos/_version.py index e072368e..987ad168 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,4 +1,4 @@ """ version info """ -__version__ = "0.36.13" +__version__ = "0.36.14" diff --git a/osxphotos/photoinfo/_photoinfo_export.py b/osxphotos/photoinfo/_photoinfo_export.py index 61f00d74..63686716 100644 --- a/osxphotos/photoinfo/_photoinfo_export.py +++ b/osxphotos/photoinfo/_photoinfo_export.py @@ -1072,8 +1072,8 @@ def _exiftool_dict( EXIF:DateTimeOriginal EXIF:OffsetTimeOriginal EXIF:ModifyDate - IPTC:DigitalCreationDate IPTC:DateCreated + IPTC:TimeCreated """ exif = {} @@ -1187,9 +1187,12 @@ def _exiftool_dict( exif["EXIF:OffsetTimeOriginal"] = offsettime dateoriginal = date.strftime("%Y:%m:%d") - exif["IPTC:DigitalCreationDate"] = dateoriginal exif["IPTC:DateCreated"] = dateoriginal + timeoriginal = date.strftime(f"%H:%M:%S{offsettime}") + exif["IPTC:TimeCreated"] = timeoriginal + print(f"time = {timeoriginal}") + if self.date_modified is not None and not ignore_date_modified: exif["EXIF:ModifyDate"] = self.date_modified.strftime("%Y:%m:%d %H:%M:%S") else: diff --git a/tests/test_cli.py b/tests/test_cli.py index 74360cd6..d14cb14a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2693,8 +2693,8 @@ def test_export_sidecar_keyword_template(): "EXIF:DateTimeOriginal": "2018:09:28 16:07:07", "EXIF:CreateDate": "2018:09:28 16:07:07", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2018:09:28", - "IPTC:DateCreated": "2018:09:28", + "IPTC:DateCreated": "2018:09:28", + "IPTC:TimeCreated": "16:07:07-04:00", "EXIF:ModifyDate": "2018:09:28 16:07:07"}] """ )[0] diff --git a/tests/test_export_catalina_10_15_7.py b/tests/test_export_catalina_10_15_7.py index c60a8440..2d9c2e7a 100644 --- a/tests/test_export_catalina_10_15_7.py +++ b/tests/test_export_catalina_10_15_7.py @@ -78,8 +78,8 @@ EXIF_JSON_EXPECTED = """ "EXIF:DateTimeOriginal": "2019:04:15 14:40:24", "EXIF:CreateDate": "2019:04:15 14:40:24", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2019:04:15", "IPTC:DateCreated": "2019:04:15", + "IPTC:TimeCreated": "14:40:24-04:00", "EXIF:ModifyDate": "2019:07:27 17:33:28"}] """ @@ -94,8 +94,8 @@ EXIF_JSON_EXPECTED_IGNORE_DATE_MODIFIED = """ "EXIF:DateTimeOriginal": "2019:04:15 14:40:24", "EXIF:CreateDate": "2019:04:15 14:40:24", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2019:04:15", "IPTC:DateCreated": "2019:04:15", + "IPTC:TimeCreated": "14:40:24-04:00", "EXIF:ModifyDate": "2019:04:15 14:40:24"}] """ @@ -554,8 +554,8 @@ def test_exiftool_json_sidecar_keyword_template_long(caplog): "EXIF:DateTimeOriginal": "2019:04:15 14:40:24", "EXIF:CreateDate": "2019:04:15 14:40:24", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2019:04:15", "IPTC:DateCreated": "2019:04:15", + "IPTC:TimeCreated": "14:40:24-04:00", "EXIF:ModifyDate": "2019:07:27 17:33:28"}] """ )[0] @@ -604,8 +604,8 @@ def test_exiftool_json_sidecar_keyword_template(): "EXIF:DateTimeOriginal": "2019:04:15 14:40:24", "EXIF:CreateDate": "2019:04:15 14:40:24", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2019:04:15", "IPTC:DateCreated": "2019:04:15", + "IPTC:TimeCreated": "14:40:24-04:00", "EXIF:ModifyDate": "2019:07:27 17:33:28"}] """ )[0] @@ -666,8 +666,8 @@ def test_exiftool_json_sidecar_use_persons_keyword(): "EXIF:DateTimeOriginal": "2018:09:28 15:35:49", "EXIF:CreateDate": "2018:09:28 15:35:49", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2018:09:28", "IPTC:DateCreated": "2018:09:28", + "IPTC:TimeCreated": "15:35:49-04:00", "EXIF:ModifyDate": "2018:09:28 15:35:49"}] """ )[0] @@ -709,8 +709,8 @@ def test_exiftool_json_sidecar_use_albums_keyword(): "EXIF:DateTimeOriginal": "2018:09:28 15:35:49", "EXIF:CreateDate": "2018:09:28 15:35:49", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2018:09:28", "IPTC:DateCreated": "2018:09:28", + "IPTC:TimeCreated": "15:35:49-04:00", "EXIF:ModifyDate": "2018:09:28 15:35:49"}] """ )[0] diff --git a/tests/test_export_mojave_10_14_6.py b/tests/test_export_mojave_10_14_6.py index 9354d6bf..b965654e 100644 --- a/tests/test_export_mojave_10_14_6.py +++ b/tests/test_export_mojave_10_14_6.py @@ -58,8 +58,8 @@ EXIF_JSON_EXPECTED = """ "EXIF:DateTimeOriginal": "2018:10:13 09:18:12", "EXIF:CreateDate": "2018:10:13 09:18:12", "EXIF:OffsetTimeOriginal": "-04:00", - "IPTC:DigitalCreationDate": "2018:10:13", "IPTC:DateCreated": "2018:10:13", + "IPTC:TimeCreated": "09:18:12-04:00", "EXIF:ModifyDate": "2019:12:01 11:43:45"}] """