From 7732708cb2ea484f7fc56b5fedfc34434dfe4a7c Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sat, 23 Nov 2019 19:24:20 -0800 Subject: [PATCH] fixed command line to better handle detected but unidentified faces in Photos 5 --- osxphotos/cmd_line.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osxphotos/cmd_line.py b/osxphotos/cmd_line.py index eef2448d..76844753 100644 --- a/osxphotos/cmd_line.py +++ b/osxphotos/cmd_line.py @@ -94,6 +94,15 @@ def info(cli_obj): info["albums"] = albums persons = pdb.persons_as_dict() + # handle empty person names (added by Photos 5.0+ when face detected but not identified) + noperson = "UNKNOWN" + if "" in persons: + if noperson in persons: + persons[noperson].append(persons[""]) + else: + persons[noperson] = persons[""] + persons.pop("", None) + info["persons_count"] = len(persons) info["persons"] = persons