From 201bdacddd81a10119c2e0cd3607629a0beaa6cf Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Tue, 25 Jul 2023 06:55:23 -0700 Subject: [PATCH] Release v0.61.0 (#1132) --- .bumpversion.cfg | 2 +- API_README.md | 2 +- README.md | 50 ++- docs/.buildinfo | 2 +- docs/_modules/index.html | 6 +- docs/_modules/osxphotos/_constants.html | 6 +- docs/_modules/osxphotos/albuminfo.html | 6 +- docs/_modules/osxphotos/debug.html | 6 +- docs/_modules/osxphotos/exifinfo.html | 315 +++++++++++++----- docs/_modules/osxphotos/exiftool.html | 6 +- docs/_modules/osxphotos/export_db.html | 6 +- docs/_modules/osxphotos/fileutil.html | 6 +- docs/_modules/osxphotos/momentinfo.html | 83 ++--- docs/_modules/osxphotos/personinfo.html | 26 +- docs/_modules/osxphotos/photoexporter.html | 12 +- docs/_modules/osxphotos/photoinfo.html | 6 +- docs/_modules/osxphotos/photosalbum.html | 6 +- .../photosdb/_photosdb_process_comments.html | 6 +- .../_modules/osxphotos/photosdb/photosdb.html | 6 +- docs/_modules/osxphotos/phototemplate.html | 6 +- docs/_modules/osxphotos/placeinfo.html | 6 +- docs/_modules/osxphotos/queryoptions.html | 6 +- docs/_modules/osxphotos/scoreinfo.html | 6 +- docs/_modules/osxphotos/searchinfo.html | 6 +- docs/_sources/template_help.rst.txt | 2 +- docs/_static/documentation_options.js | 2 +- docs/cli.html | 89 ++--- docs/genindex.html | 15 +- docs/index.html | 6 +- docs/objects.inv | Bin 9859 -> 9863 bytes docs/overview.html | 6 +- docs/package_overview.html | 6 +- docs/py-modindex.html | 6 +- docs/reference.html | 8 +- docs/search.html | 6 +- docs/searchindex.js | 2 +- docs/template_help.html | 8 +- docs/tutorial.html | 6 +- docsrc/source/template_help.rst | 2 +- osxphotos/_version.py | 2 +- osxphotos/docs/docs.zip | Bin 1479628 -> 1479401 bytes 41 files changed, 479 insertions(+), 275 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 4b28f01c..62ef9ed9 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.60.10 +current_version = 0.61.0 parse = (?P\d+)\.(?P\d+)\.(?P\d+) serialize = {major}.{minor}.{patch} diff --git a/API_README.md b/API_README.md index fc733e40..01f6e316 100644 --- a/API_README.md +++ b/API_README.md @@ -2503,7 +2503,7 @@ cog.out(get_template_field_table()) |{cr}|A carriage return: '\r'| |{crlf}|A carriage return + line feed: '\r\n'| |{tab}|:A tab: '\t'| -|{osxphotos_version}|The osxphotos version, e.g. '0.60.10'| +|{osxphotos_version}|The osxphotos version, e.g. '0.61.0'| |{osxphotos_cmd_line}|The full command line used to run osxphotos| |{album}|Album(s) photo is contained in| |{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder| diff --git a/README.md b/README.md index 77a1a57d..5c78a4a7 100644 --- a/README.md +++ b/README.md @@ -1117,6 +1117,52 @@ Options: of different types but the same name in the output directory, e.g. 'IMG_1234.JPG' and 'IMG_1234.MOV'. + --sidecar-template MAKO_TEMPLATE_FILE SIDECAR_FILENAME_TEMPLATE WRITE_SKIPPED STRIP_WHITESPACE STRIP_LINES + Create a custom sidecar file for each photo + exported with user provided Mako template + (MAKO_TEMPLATE_FILE). MAKO_TEMPLATE_FILE must + be a valid Mako template (see + https://www.makotemplates.org/). The template + will passed the following variables: photo + (PhotoInfo object for the photo being + exported), sidecar_path (pathlib.Path object + for the path to the sidecar being written), + and photo_path (pathlib.Path object for the + path to the exported photo. + SIDECAR_FILENAME_TEMPLATE must be a valid + template string (see Templating System in + help) which will be rendered to generate the + filename of the sidecar file. The `{filepath}` + template variable may be used in the + SIDECAR_FILENAME_TEMPLATE to refer to the + filename of the photo being exported. + WRITE_SKIPPED is a boolean value (true/false, + yes/no, 1/0 are all valid values) and + indicates whether or not write the sidecar + file even if the photo is skipped during + export. If WRITE_SKIPPED is false, the sidecar + file will not be written if the photo is + skipped during export. If WRITE_SKIPPED is + true, the sidecar file will be written even if + the photo is skipped during export. + STRIP_WHITESPACE and STRIP_LINES are boolean + values (true/false, yes/no, 1/0 are all valid + values) and indicate whether or not to strip + whitespace and blank lines from the resulting + sidecar file. For example, to create a sidecar + file with extension .xmp using a template file + named 'sidecar.mako' and write a sidecar for + skipped photos and strip blank lines but not + whitespace: `--sidecar-template sidecar.mako + '{filepath}.xmp' yes no yes`. To do the same + but to drop the photo extension from the + sidecar filename: `--sidecar-template + sidecar.mako + '{filepath.parent}/{filepath.stem}.xmp' yes no + yes --sidecar-drop-ext`. For an example Mako + file see https://raw.githubusercontent.com/Rhe + tTbull/osxphotos/main/examples/custom_sidecar. + mako --exiftool Use exiftool to write metadata directly to exported photos. To use this option, exiftool must be installed and in the path. exiftool @@ -2124,7 +2170,7 @@ Substitution Description {cr} A carriage return: '\r' {crlf} A carriage return + line feed: '\r\n' {tab} :A tab: '\t' -{osxphotos_version} The osxphotos version, e.g. '0.60.10' +{osxphotos_version} The osxphotos version, e.g. '0.61.0' {osxphotos_cmd_line} The full command line used to run osxphotos The following substitutions may result in multiple values. Thus if specified @@ -2611,7 +2657,7 @@ The following template field substitutions are availabe for use the templating s |{cr}|A carriage return: '\r'| |{crlf}|A carriage return + line feed: '\r\n'| |{tab}|:A tab: '\t'| -|{osxphotos_version}|The osxphotos version, e.g. '0.60.10'| +|{osxphotos_version}|The osxphotos version, e.g. '0.61.0'| |{osxphotos_cmd_line}|The full command line used to run osxphotos| |{album}|Album(s) photo is contained in| |{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder| diff --git a/docs/.buildinfo b/docs/.buildinfo index 3021e6fe..88a0705d 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: a367b45578573ddea17324e7158c350f +config: b13e33299efc7bf921ed35d6fb356cb4 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_modules/index.html b/docs/_modules/index.html index d91dfd23..c15e678b 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -5,7 +5,7 @@ - Overview: module code - osxphotos 0.60.10 documentation + Overview: module code - osxphotos 0.61.0 documentation @@ -123,7 +123,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/_modules/osxphotos/exiftool.html b/docs/_modules/osxphotos/exiftool.html index 4838ffc2..1cf36d35 100644 --- a/docs/_modules/osxphotos/exiftool.html +++ b/docs/_modules/osxphotos/exiftool.html @@ -5,7 +5,7 @@ - osxphotos.exiftool - osxphotos 0.59.1 documentation + osxphotos.exiftool - osxphotos 0.61.0 documentation @@ -123,7 +123,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@ @@ -179,7 +179,8 @@ Back to top -
+
+

Source code for osxphotos.momentinfo

-__all__ = ["MomentInfo"]
-"""MomentInfo class with details about photo moments."""
+__all__ = ["MomentInfo"]
+"""MomentInfo class with details about photo moments."""
 
 
 
[docs]class MomentInfo: - """Info about a photo moment""" + """Info about a photo moment""" def __init__(self, db, moment_pk): - """Initialize with a moment PK; returns None if PK not found.""" + """Initialize with a moment PK; returns None if PK not found.""" self._db = db self._pk = moment_pk self._moment = self._db._db_moment_pk.get(moment_pk) if not self._moment: - raise ValueError(f"No moment with PK {moment_pk}") + raise ValueError(f"No moment with PK {moment_pk}") @property def pk(self): - """Primary key of the moment.""" + """Primary key of the moment.""" return self._pk @property def location(self): - """Location of the moment.""" - return (self._moment.get("latitude"), self._moment.get("longitude")) + """Location of the moment.""" + return (self._moment.get("latitude"), self._moment.get("longitude")) @property def title(self): - """Title of the moment.""" - return self._moment.get("title") + """Title of the moment.""" + return self._moment.get("title") @property def subtitle(self): - """Subtitle of the moment.""" - return self._moment.get("subtitle") + """Subtitle of the moment.""" + return self._moment.get("subtitle") @property def start_date(self): - """Start date of the moment.""" - return self._moment.get("startDate") + """Start date of the moment.""" + return self._moment.get("startDate") @property def end_date(self): - """Stop date of the moment.""" - return self._moment.get("endDate") + """Stop date of the moment.""" + return self._moment.get("endDate") @property def date(self): - """Date of the moment.""" - return self._moment.get("representativeDate") + """Date of the moment.""" + return self._moment.get("representativeDate") @property def modification_date(self): - """Modification date of the moment.""" - return self._moment.get("modificationDate") + """Modification date of the moment.""" + return self._moment.get("modificationDate") @property def photos(self): - """All photos in this moment""" + """All photos in this moment""" try: return self._photos except AttributeError: photo_uuids = [ uuid for uuid, photo in self._db._dbphotos.items() - if photo["momentID"] == self._pk + if photo["momentID"] == self._pk ] self._photos = self._db.photos_by_uuid(photo_uuids) return self._photos
[docs] def asdict(self): - """Returns all moment info as dictionary""" + """Returns all moment info as dictionary""" return { - "pk": self.pk, - "location": self.location, - "title": self.title, - "subtitle": self.subtitle, - "start_date": self.start_date.isoformat() if self.start_date else None, - "end_date": self.end_date.isoformat() if self.end_date else None, - "date": self.date.isoformat() if self.date else None, - "modification_date": self.modification_date.isoformat() + "pk": self.pk, + "location": self.location, + "title": self.title, + "subtitle": self.subtitle, + "start_date": self.start_date.isoformat() if self.start_date else None, + "end_date": self.end_date.isoformat() if self.end_date else None, + "date": self.date.isoformat() if self.date else None, + "modification_date": self.modification_date.isoformat() if self.modification_date else None, - "photos": self.photos, + "photos": self.photos, }
@@ -317,7 +318,9 @@
+ + diff --git a/docs/_modules/osxphotos/personinfo.html b/docs/_modules/osxphotos/personinfo.html index d6d04138..62fd3808 100644 --- a/docs/_modules/osxphotos/personinfo.html +++ b/docs/_modules/osxphotos/personinfo.html @@ -5,7 +5,7 @@ - osxphotos.personinfo - osxphotos 0.58.1 documentation + osxphotos.personinfo - osxphotos 0.61.0 documentation @@ -123,7 +123,7 @@
@@ -146,7 +146,7 @@ -class FaceInfo: +
[docs]class FaceInfo: """Info about a face in the Photos library""" def __init__(self, db=None, pk=None): @@ -472,7 +472,7 @@ return MPRI_Reg_Rect(x, y, h, w) - def face_rect(self): +
[docs] def face_rect(self): """Get face rectangle coordinates for current version of the associated image If image has been edited, rectangle applies to edited version, otherwise original version Coordinates in format and reference frame used by PIL @@ -486,16 +486,16 @@ x, y = self._make_point((self.center_x, self.center_y)) x0, y0 = x - radius, y - radius x1, y1 = x + radius, y + radius - return [(x0, y0), (x1, y1)] + return [(x0, y0), (x1, y1)]
- def roll_pitch_yaw(self): +
[docs] def roll_pitch_yaw(self): """Roll, pitch, yaw of face in radians as tuple""" info = self._info roll = 0 if info["roll"] is None else info["roll"] pitch = 0 if info["pitch"] is None else info["pitch"] yaw = 0 if info["yaw"] is None else info["yaw"] - return (roll, pitch, yaw) + return (roll, pitch, yaw)
@property def roll(self): @@ -598,7 +598,7 @@ return (int(xr), int(yr)) - def asdict(self): +
[docs] def asdict(self): """Returns dict representation of class instance""" roll, pitch, yaw = self.roll_pitch_yaw() return { @@ -633,11 +633,11 @@ "intrash": self.intrash, "lip_makeup_type": self.lip_makeup_type, "smile_type": self.smile_type, - } + }
- def json(self): +
[docs] def json(self): """Return JSON representation of FaceInfo instance""" - return json.dumps(self.asdict()) + return json.dumps(self.asdict())
def __str__(self): return f"FaceInfo(uuid={self.uuid}, center_x={self.center_x}, center_y = {self.center_y}, size={self.size}, person={self.name}, asset_uuid={self.asset_uuid})" @@ -654,7 +654,7 @@ ) def __ne__(self, other): - return not self.__eq__(other) + return not self.__eq__(other)
def rotate_image_point(x, y, xmid, ymid, angle): diff --git a/docs/_modules/osxphotos/photoexporter.html b/docs/_modules/osxphotos/photoexporter.html index c4673cc2..1572649c 100644 --- a/docs/_modules/osxphotos/photoexporter.html +++ b/docs/_modules/osxphotos/photoexporter.html @@ -5,7 +5,7 @@ - osxphotos.photoexporter - osxphotos 0.60.7 documentation + osxphotos.photoexporter - osxphotos 0.61.0 documentation @@ -123,7 +123,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -146,7 +146,7 @@
@@ -147,7 +147,7 @@
@@ -145,7 +145,7 @@
@@ -147,7 +147,7 @@
@@ -147,7 +147,7 @@
@@ -147,7 +147,7 @@
@@ -145,7 +145,7 @@
@@ -147,7 +147,7 @@
@@ -144,7 +144,7 @@
@@ -147,7 +147,7 @@
@@ -147,7 +147,7 @@