Updated OTL to MTL

This commit is contained in:
Rhet Turnbull
2021-11-06 07:13:02 -07:00
parent 818f4f45a4
commit 2ffcf1e82b
4 changed files with 9 additions and 9 deletions

View File

@@ -1260,8 +1260,8 @@ s
** Templating System ** ** Templating System **
The templating system converts one or template statements, written in osxphotos The templating system converts one or template statements, written in osxphotos
templating language, to one or more rendered values using information from the metadata templating language, to one or more rendered values using information
photo being processed. from the photo being processed.
In its simplest form, a template statement has the form: "{template_field}", for In its simplest form, a template statement has the form: "{template_field}", for
example "{title}" which would resolve to the title of the photo. example "{title}" which would resolve to the title of the photo.
@@ -2775,7 +2775,7 @@ If overwrite=False and increment=False, export will fail if destination file alr
Render template string for photo. none_str is used if template substitution results in None value and no default specified. Render template string for photo. none_str is used if template substitution results in None value and no default specified.
- `template_str`: str in osxphotos template language (OTL) format. See also [Template System](#template-system) table. See notes below regarding specific details of the syntax. - `template_str`: str in metadata template language (MTL) format. See also [Template System](#template-system) table. See notes below regarding specific details of the syntax.
- `options`: an optional osxphotos.phototemplate.RenderOptions object specifying the options to pass to the rendering engine. - `options`: an optional osxphotos.phototemplate.RenderOptions object specifying the options to pass to the rendering engine.
`RenderOptions` has the following properties: `RenderOptions` has the following properties:
@@ -3353,7 +3353,7 @@ To get the path of every raw photo, whether it's a single raw photo or a raw+JPE
### Template System ### Template System
<!-- OSXPHOTOS-TEMPLATE-HELP:START - Do not remove or modify this section --> <!-- OSXPHOTOS-TEMPLATE-HELP:START - Do not remove or modify this section -->
The templating system converts one or template statements, written in osxphotos templating language, to one or more rendered values using information from the photo being processed. The templating system converts one or template statements, written in osxphotos metadata templating language, to one or more rendered values using information from the photo being processed.
In its simplest form, a template statement has the form: `"{template_field}"`, for example `"{title}"` which would resolve to the title of the photo. In its simplest form, a template statement has the form: `"{template_field}"`, for example `"{title}"` which would resolve to the title of the photo.

View File

@@ -1,4 +1,4 @@
The templating system converts one or template statements, written in osxphotos templating language, to one or more rendered values using information from the photo being processed. The templating system converts one or template statements, written in osxphotos metadata templating language, to one or more rendered values using information from the photo being processed.
In its simplest form, a template statement has the form: `"{template_field}"`, for example `"{title}"` which would resolve to the title of the photo. In its simplest form, a template statement has the form: `"{template_field}"`, for example `"{title}"` which would resolve to the title of the photo.

View File

@@ -1,4 +1,4 @@
""" Custom template system for osxphotos, implements osxphotos template language (OTL) """ """ Custom template system for osxphotos, implements metadata template language (MTL) """
import datetime import datetime
import json import json
@@ -27,7 +27,7 @@ from .utils import expand_and_validate_filepath, load_function
# ensure locale set to user's locale # ensure locale set to user's locale
locale.setlocale(locale.LC_ALL, "") locale.setlocale(locale.LC_ALL, "")
OTL_GRAMMAR_MODEL = str(pathlib.Path(__file__).parent / "phototemplate.tx") MTL_GRAMMAR_MODEL = str(pathlib.Path(__file__).parent / "phototemplate.tx")
"""TextX metamodel for osxphotos template language """ """TextX metamodel for osxphotos template language """
@@ -324,7 +324,7 @@ class PhotoTemplateParser:
if hasattr(self, "metamodel"): if hasattr(self, "metamodel"):
return return
self.metamodel = metamodel_from_file(OTL_GRAMMAR_MODEL, skipws=False) self.metamodel = metamodel_from_file(MTL_GRAMMAR_MODEL, skipws=False)
def parse(self, template_statement): def parse(self, template_statement):
"""Parse a template_statement string""" """Parse a template_statement string"""

View File

@@ -1,4 +1,4 @@
// OSXPhotos Template Language (OTL) // OSXPhotos Metadata Template Language (MTL)
// a TemplateString has format: // a TemplateString has format:
// pre{delim+template_field:subfield|filter(path_sep)[find,replace] conditional?bool_value,default}post // pre{delim+template_field:subfield|filter(path_sep)[find,replace] conditional?bool_value,default}post
// a TemplateStatement may contain zero or more TemplateStrings // a TemplateStatement may contain zero or more TemplateStrings