added created.dd and modified.dd to template system, closes #135

This commit is contained in:
Rhet Turnbull
2020-05-23 21:39:40 -07:00
parent af750dd2e3
commit 28935b0af9
7 changed files with 48 additions and 1 deletions

View File

@@ -1,3 +1,3 @@
""" version info """
__version__ = "0.29.2"
__version__ = "0.29.3"

View File

@@ -45,6 +45,12 @@ class DateTimeFormatter:
mon = f"{self.dt.strftime('%b')}"
return mon
@property
def dd(self):
""" 2-digit day of the month """
dd = f"{self.dt.strftime('%d')}"
return dd
@property
def doy(self):
""" Julian day of year starting from 001 """

View File

@@ -836,6 +836,9 @@ class PhotoInfo:
if lookup == "created.mon":
return DateTimeFormatter(self.date).mon
if lookup == "created.dd":
return DateTimeFormatter(self.date).dd
if lookup == "created.doy":
return DateTimeFormatter(self.date).doy
@@ -877,6 +880,11 @@ class PhotoInfo:
else None
)
if lookup == "modified.dd":
return (
DateTimeFormatter(self.date_modified).dd if self.date_modified else None
)
if lookup == "modified.doy":
return (
DateTimeFormatter(self.date_modified).doy

View File

@@ -26,6 +26,7 @@ TEMPLATE_SUBSTITUTIONS = {
"{created.mm}": "2-digit month of the file creation time (zero padded)",
"{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.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",
@@ -33,6 +34,7 @@ TEMPLATE_SUBSTITUTIONS = {
"{modified.mm}": "2-digit month of the file modification time (zero padded)",
"{modified.month}": "Month name in user's locale of the file modification time",
"{modified.mon}": "Month abbreviation in the user's locale of the file modification time",
"{modified.dd}": "2-digit day of the month (zero padded) of the file modification time",
"{modified.doy}": "3-digit day of year (e.g Julian day) of file modification time, starting from 1 (zero padded)",
"{place.name}": "Place name from the photo's reverse geolocation data, as displayed in Photos",
"{place.country_code}": "The ISO country code from the photo's reverse geolocation data",