From 8df6d2c707caf4eb35696888282365a128b69569 Mon Sep 17 00:00:00 2001 From: Stephane Date: Sun, 24 May 2020 14:20:25 +0200 Subject: [PATCH] added created.dow (day of week) to template --- osxphotos/datetime_formatter.py | 8 +++++++- osxphotos/photoinfo/photoinfo.py | 3 +++ osxphotos/photoinfo/template.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osxphotos/datetime_formatter.py b/osxphotos/datetime_formatter.py index 1cd9b658..541c2696 100644 --- a/osxphotos/datetime_formatter.py +++ b/osxphotos/datetime_formatter.py @@ -50,7 +50,13 @@ class DateTimeFormatter: """ 2-digit day of the month """ dd = f"{self.dt.strftime('%d')}" return dd - + + @property + def dow(self): + """ Day of week as locale's name """ + dow = f"{self.dt.strftime('%A')}" + return dow + @property def doy(self): """ Julian day of year starting from 001 """ diff --git a/osxphotos/photoinfo/photoinfo.py b/osxphotos/photoinfo/photoinfo.py index da7887ff..2eb52b01 100644 --- a/osxphotos/photoinfo/photoinfo.py +++ b/osxphotos/photoinfo/photoinfo.py @@ -839,6 +839,9 @@ class PhotoInfo: if lookup == "created.dd": return DateTimeFormatter(self.date).dd + if lookup == "created.dow": + return DateTimeFormatter(self.date).dow + if lookup == "created.doy": return DateTimeFormatter(self.date).doy diff --git a/osxphotos/photoinfo/template.py b/osxphotos/photoinfo/template.py index 198fcb5b..bdbf322d 100644 --- a/osxphotos/photoinfo/template.py +++ b/osxphotos/photoinfo/template.py @@ -27,6 +27,7 @@ TEMPLATE_SUBSTITUTIONS = { "{created.month}": "Month name in user's locale of the file creation time", "{created.mon}": "Month abbreviation in the user's locale of the file creation time", "{created.dd}": "2-digit day of the month (zero padded) of file creation time", + "{created.dow}": "Day of week in user's locale of the file creation time", "{created.doy}": "3-digit day of year (e.g Julian day) of file creation time, starting from 1 (zero padded)", "{modified.date}": "Photo's modification date in ISO format, e.g. '2020-03-22'", "{modified.year}": "4-digit year of file modification time",