mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 02:59:27 +00:00
KeyError
This commit is contained in:
@@ -192,6 +192,8 @@ def get_image_info(item: str, folder: str) -> dict[str, Any]:
|
||||
xmp = xmpdata
|
||||
except TypeError:
|
||||
...
|
||||
except KeyError:
|
||||
...
|
||||
try:
|
||||
tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
|
||||
if isinstance(tags, str):
|
||||
@@ -199,6 +201,8 @@ def get_image_info(item: str, folder: str) -> dict[str, Any]:
|
||||
xmp = xmpdata
|
||||
except TypeError:
|
||||
...
|
||||
except KeyError:
|
||||
...
|
||||
if None in tags:
|
||||
tags.remove(None)
|
||||
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"]
|
||||
if isinstance(tags, str):
|
||||
tags = [tags]
|
||||
xmp = xmpdata
|
||||
except TypeError:
|
||||
...
|
||||
except KeyError:
|
||||
...
|
||||
try:
|
||||
tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
|
||||
if isinstance(tags, str):
|
||||
tags = [tags]
|
||||
xmp = xmpdata
|
||||
except TypeError:
|
||||
...
|
||||
except KeyError:
|
||||
...
|
||||
if None in tags:
|
||||
tags.remove(None)
|
||||
return tags
|
||||
|
||||
Reference in New Issue
Block a user