diff --git a/CHANGELOG.md b/CHANGELOG.md index 670852f8..eebcf3e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v0.34.3](https://github.com/RhetTbull/osxphotos/compare/v0.34.2...v0.34.3) + +> 29 September 2020 + +- Update exiftool.py to preserve file modification time, thanks to @hhoeck [`#223`](https://github.com/RhetTbull/osxphotos/pull/223) +- Added tests for 10.15.6 [`432da7f`](https://github.com/RhetTbull/osxphotos/commit/432da7f139a5e4b37eeb358f4ede45314407f8e5) +- Fixed bug related to issue #222 [`c939df7`](https://github.com/RhetTbull/osxphotos/commit/c939df717159e8b97955c0b267327cd56a9ed56c) +- Version bump for bug fix [`62d54cc`](https://github.com/RhetTbull/osxphotos/commit/62d54cc0beabd0141545608184d4b2c658eedf0f) +- Update README.md [`6883fec`](https://github.com/RhetTbull/osxphotos/commit/6883fec2b2236d892b88327e1b4e9da1237f7dea) +- Update exiftool.py [`3d21dad`](https://github.com/RhetTbull/osxphotos/commit/3d21dadf4102e9101e48a0c6f739a544f7f9d9de) + #### [v0.34.2](https://github.com/RhetTbull/osxphotos/compare/v0.34.1...v0.34.2) > 14 September 2020 diff --git a/README.md b/README.md index 9e9468e6..176e55d5 100644 --- a/README.md +++ b/README.md @@ -1941,6 +1941,7 @@ Thank-you to the following people who have contributed to improving osxphotos! - [grundsch](https://github.com/grundsch) - [Ag Primatic](https://github.com/agprimatic) - [Daniel M. Drucker](https://github.com/dmd) +- [Horst Höck](https://github.com/hhoeck) ## Known Bugs diff --git a/osxphotos/_version.py b/osxphotos/_version.py index a9c7a7d4..a68d794e 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,3 +1,4 @@ """ version info """ __version__ = "0.35.0" + diff --git a/osxphotos/exiftool.py b/osxphotos/exiftool.py index 6e4fdbd0..b54ac9d6 100644 --- a/osxphotos/exiftool.py +++ b/osxphotos/exiftool.py @@ -98,6 +98,7 @@ class _ExifToolProc: "-", # read from stdin "-common_args", # specifies args common to all commands subsequently run "-n", # no print conversion (e.g. print tag values in machine readable format) + "-P", # Preserve file modification date/time (possible interfere w/ --touch-file) "-G", # print group name for each tag ], stdin=subprocess.PIPE, diff --git a/osxphotos/photosdb/photosdb.py b/osxphotos/photosdb/photosdb.py index 448c45ce..a8164d67 100644 --- a/osxphotos/photosdb/photosdb.py +++ b/osxphotos/photosdb/photosdb.py @@ -1323,11 +1323,12 @@ class PhotosDB: # get the place info that matches the RKPlace modelIDs for this photo # (place_ids), sort by area (element 3 of the place_data tuple in places) + # area could be None so assume 0 if it is (issue #230) place_names = [ pname for pname in sorted( [places[p] for p in places if p in place_ids], - key=lambda place: place[3], + key=lambda place: place[3] if place[3] is not None else 0, ) ] diff --git a/tests/test_cli.py b/tests/test_cli.py index ca84d0ec..49c4d7be 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -235,8 +235,8 @@ CLI_EXPORT_UUID_STATUE = "3DD2C897-F19E-4CA6-8C22-B027D5A71907" CLI_EXPORT_UUID_FILENAME = "Pumkins2.jpg" CLI_EXPORT_BY_DATE_TOUCH_UUID = [ - "1EB2B765-0765-43BA-A90C-0D0580E6172C", - "F12384F6-CD17-4151-ACBA-AE0E3688539E", + "1EB2B765-0765-43BA-A90C-0D0580E6172C", # Pumpkins3.jpg + "F12384F6-CD17-4151-ACBA-AE0E3688539E", # Pumkins1.jpg ] CLI_EXPORT_BY_DATE_TOUCH_TIMES = [1538165373, 1538163349] CLI_EXPORT_BY_DATE_NEED_TOUCH = [ @@ -399,6 +399,7 @@ CLI_EXPORT_UUID_FROM_FILE_FILENAMES = [ "wedding_edited.jpeg", ] + # determine if exiftool installed so exiftool tests can be skipped try: exiftool = get_exiftool_path() @@ -407,9 +408,9 @@ except: def touch_all_photos_in_db(dbpath): - """ touch date on all photos in a library + """touch date on all photos in a library helper function for --touch-file tests - + Args: dbpath: path to photos library to touch """ @@ -437,13 +438,14 @@ def setup_touch_tests(): import logging import osxphotos + # touch all photos so they do not match PhotoInfo.date touch_all_photos_in_db(PHOTOS_DB_TOUCH) + # adjust a couple of the photos so they're file times *are* correct photos = osxphotos.PhotosDB(PHOTOS_DB_TOUCH).photos_by_uuid( CLI_EXPORT_BY_DATE_TOUCH_UUID ) for photo in photos: - logging.warning(photo.path) ts = int(photo.date.timestamp()) if photo.path is not None: os.utime(photo.path, (ts, ts)) @@ -3091,9 +3093,10 @@ def test_export_touch_files_update(): ) +# @pytest.mark.skip("TODO: This fails on some machines but not all") @pytest.mark.skipif(exiftool is None, reason="exiftool not installed") def test_export_touch_files_exiftool_update(): - """ test complex export scenario with --update, --exiftol, and --touch-files """ + """ test complex export scenario with --update, --exiftool, and --touch-files """ import os import pathlib import time @@ -3199,10 +3202,6 @@ def test_export_touch_files_exiftool_update(): in result.output ) - for fname, mtime in zip(CLI_EXPORT_BY_DATE, CLI_EXPORT_BY_DATE_TOUCH_TIMES): - st = os.stat(fname) - assert int(st.st_mtime) != int(mtime) - # --update --touch-file --exiftool result = runner.invoke( export,