Test library update

This commit is contained in:
Rhet Turnbull
2020-04-12 14:52:35 -07:00
parent 952741d488
commit 21e7020fec
22 changed files with 27 additions and 20 deletions

View File

@@ -10,6 +10,7 @@
# This code isn't elegant but it seems to work well. PRs gladly accepted.
import datetime
import os
import pathlib
import re
from typing import Tuple, List # pylint: disable=syntax-error
@@ -55,7 +56,7 @@ TEMPLATE_SUBSTITUTIONS = {
# Permitted multi-value substitutions (each of these returns None or 1 or more values)
TEMPLATE_SUBSTITUTIONS_MULTI_VALUED = {
"{album}": "Album(s) photo is contained in",
# "{folder}": "Folder path + album photo is contained in. e.g. Folder/Subfolder/Album",
"{folder_album}": "Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder",
"{keyword}": "Keyword(s) assigned to photo",
"{person}": "Person(s) / face(s) in a photo",
}
@@ -322,12 +323,18 @@ def render_filepath_template(template, photo, none_str="_"):
values = photo.persons
# remove any _UNKNOWN_PERSON values
values = [val for val in values if val != _UNKNOWN_PERSON]
# elif field == "folder":
# folders = []
# # photos must be in an album to be in a folder
# albums = photo.albums
# for album in albums:
# zzz
elif field == "folder_album":
values = []
# photos must be in an album to be in a folder
for album in photo.album_info:
if album.folder_names:
# album in folder
folder = os.path.sep.join(album.folder_names)
folder += os.path.sep + album.title
values.append(folder)
else:
# album not in folder
values.append(album.title)
else:
raise ValueError(f"Unhandleded template value: {field}")