This commit is contained in:
2026-06-11 13:21:35 -04:00
parent 7b83dbd114
commit 11ff3752d3
2 changed files with 8 additions and 4 deletions
+3 -2
View File
@@ -74,10 +74,11 @@ def process_face_mode(
# Find face metadata for this person # Find face metadata for this person
face_info = None face_info = None
for p in asset.get("people", []): people_list = asset.get("people") or []
for p in people_list:
if p is None: if p is None:
continue continue
if p["id"] == person["id"] and (faces := p.get("faces")): if p.get("id") == person["id"] and (faces := p.get("faces")):
face_info = faces[0] face_info = faces[0]
break break
+5 -2
View File
@@ -117,7 +117,10 @@ def fetch_face_data(asset_id: str, person_id: str | None = None) -> FaceData | N
# Match the target person if specified # Match the target person if specified
face = None face = None
if person_id: if person_id:
face = next((f for f in faces if f.get("person", {}).get("id") == person_id), None) face = next(
(f for f in faces if (f.get("person") or {}).get("id") == person_id),
None,
)
if face is None: if face is None:
face = faces[0] # Fall back to first/largest face face = faces[0] # Fall back to first/largest face
@@ -145,7 +148,7 @@ def fetch_face_data(asset_id: str, person_id: str | None = None) -> FaceData | N
except requests.RequestException as e: except requests.RequestException as e:
logger.debug(f"Failed to fetch face data for {asset_id}: {e}") logger.debug(f"Failed to fetch face data for {asset_id}: {e}")
return None return None
except (KeyError, TypeError, ValueError) as e: except (AttributeError, KeyError, TypeError, ValueError) as e:
logger.debug(f"Failed to parse face data for {asset_id}: {e}") logger.debug(f"Failed to parse face data for {asset_id}: {e}")
return None return None