added {place.country_code} to template system

This commit is contained in:
Rhet Turnbull
2020-03-28 10:18:58 -07:00
parent b0456dc8e6
commit be2e16769d
4 changed files with 7 additions and 1 deletions

View File

@@ -1007,6 +1007,7 @@ e.g. `render_filepath_template("{created.year}/{foo}", photo)` would return `("2
|{modified.mon}|Month abbreviation in the user's locale 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 geolocationo data|
|{place.name.country}|Country name from the photo's reverse geolocation data|
|{place.name.state_province}|State or province name from the photo's reverse geolocation data|
|{place.name.city}|City or locality name from the photo's reverse geolocation data|

View File

@@ -1,3 +1,3 @@
""" version info """
__version__ = "0.24.1"
__version__ = "0.24.2"

View File

@@ -25,6 +25,7 @@ TEMPLATE_SUBSTITUTIONS = {
"{modified.mon}": "Month abbreviation in the user's locale 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 geolocationo data",
"{place.name.country}": "Country name from the photo's reverse geolocation data",
"{place.name.state_province}": "State or province name from the photo's reverse geolocation data",
"{place.name.city}": "City or locality name from the photo's reverse geolocation data",
@@ -119,6 +120,9 @@ def get_template_value(lookup, photo):
if lookup == "place.name":
return photo.place.name if photo.place else None
if lookup == "place.country_code":
return photo.place.country_code if photo.place else None
if lookup == "place.name.country":
return (
photo.place.names.country[0]

View File

@@ -26,6 +26,7 @@ TEMPLATE_VALUES = {
"{modified.mon}": "Mar",
"{modified.doy}": "081",
"{place.name}": "Washington, District of Columbia, United States",
"{place.country_code}": "US",
"{place.name.country}": "United States",
"{place.name.state_province}": "District of Columbia",
"{place.name.city}": "Washington",