Added batch_edit.py example, [skip ci]

This commit is contained in:
Rhet Turnbull 2023-02-21 21:29:59 -08:00
parent b2ed70b00c
commit 8fdecd56f5

View File

@ -179,7 +179,10 @@ def set_photo_keywords_from_template(
ps_photo.keywords = list(keywords)
@functools.lru_cache(maxsize=128)
# cache photoscript Photo object to avoid re-creating it for each photo
# maxsize=1 as this function is called repeatedly for each photo then
# the next photo is processed
@functools.lru_cache(maxsize=1)
def photoscript_photo(photo: osxphotos.PhotoInfo) -> photoscript.Photo:
"""Return photoscript Photo object for photo"""
return photoscript.Photo(photo.uuid)