fix nonetype error
This commit is contained in:
@@ -473,11 +473,17 @@ def _enrich_asset_with_face_data(asset: dict, person: dict) -> dict:
|
|||||||
|
|
||||||
if face_data is None:
|
if face_data is None:
|
||||||
logger.debug(f"No face data returned for {person.get('name')} in asset {asset.get('id')}")
|
logger.debug(f"No face data returned for {person.get('name')} in asset {asset.get('id')}")
|
||||||
|
# Clean any None entries from the people list (can come from Immich API)
|
||||||
|
if "people" in asset:
|
||||||
|
asset["people"] = [p for p in asset["people"] if p is not None]
|
||||||
return asset
|
return asset
|
||||||
|
|
||||||
# Skip zero-area bounding boxes (face detection failed or no face found)
|
# Skip zero-area bounding boxes (face detection failed or no face found)
|
||||||
if face_data.bbox == (0, 0, 0, 0):
|
if face_data.bbox == (0, 0, 0, 0):
|
||||||
logger.debug(f"Zero-area bounding box for {person.get('name')} in asset {asset.get('id')}")
|
logger.debug(f"Zero-area bounding box for {person.get('name')} in asset {asset.get('id')}")
|
||||||
|
# Clean any None entries from the people list (can come from Immich API)
|
||||||
|
if "people" in asset:
|
||||||
|
asset["people"] = [p for p in asset["people"] if p is not None]
|
||||||
return asset
|
return asset
|
||||||
|
|
||||||
face_info = {
|
face_info = {
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ 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", []):
|
for p in asset.get("people", []):
|
||||||
|
if p is None:
|
||||||
|
continue
|
||||||
if p["id"] == person["id"] and (faces := p.get("faces")):
|
if p["id"] == person["id"] and (faces := p.get("faces")):
|
||||||
face_info = faces[0]
|
face_info = faces[0]
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user