This commit is contained in:
2025-06-24 10:02:05 +02:00
parent b8cbc49647
commit d9ca40bf77

View File

@@ -192,6 +192,8 @@ def get_image_info(item: str, folder: str) -> dict[str, Any]:
xmp = xmpdata xmp = xmpdata
except TypeError: except TypeError:
... ...
except KeyError:
...
try: try:
tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"] tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
if isinstance(tags, str): if isinstance(tags, str):
@@ -199,6 +201,8 @@ def get_image_info(item: str, folder: str) -> dict[str, Any]:
xmp = xmpdata xmp = xmpdata
except TypeError: except TypeError:
... ...
except KeyError:
...
if None in tags: if None in tags:
tags.remove(None) tags.remove(None)
return {"width": width, "height": height, "tags": tags, "exifdata": exifdata, "xmp": xmp} return {"width": width, "height": height, "tags": tags, "exifdata": exifdata, "xmp": xmp}
@@ -223,16 +227,18 @@ def get_tags(sidecarfile: str) -> list[str]:
tags = xmpdata["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"] tags = xmpdata["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
if isinstance(tags, str): if isinstance(tags, str):
tags = [tags] tags = [tags]
xmp = xmpdata
except TypeError: except TypeError:
... ...
except KeyError:
...
try: try:
tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"] tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
if isinstance(tags, str): if isinstance(tags, str):
tags = [tags] tags = [tags]
xmp = xmpdata
except TypeError: except TypeError:
... ...
except KeyError:
...
if None in tags: if None in tags:
tags.remove(None) tags.remove(None)
return tags return tags