mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 02:59:27 +00:00
except TypeError
This commit is contained in:
@@ -185,20 +185,20 @@ def get_image_info(item: str, folder: str) -> dict[str, Any]:
|
||||
xmp = None
|
||||
if xmpdata:
|
||||
logger.info("extracting XMP data", extra={"file": file})
|
||||
if xmpdata.get("xmpmeta", False):
|
||||
if isinstance(xmpdata["xmpmeta"]["RDF"]["Description"], dict):
|
||||
if xmpdata["xmpmeta"]["RDF"]["Description"].get("subject", False):
|
||||
try:
|
||||
tags = xmpdata["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
|
||||
if isinstance(tags, str):
|
||||
tags = [tags]
|
||||
xmp = xmpdata
|
||||
if xmpdata.get("xapmeta", False):
|
||||
if isinstance(xmpdata["xapmeta"]["RDF"]["Description"], dict):
|
||||
if xmpdata["xapmeta"]["RDF"]["Description"].get("subject", False):
|
||||
except TypeError:
|
||||
...
|
||||
try:
|
||||
tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
|
||||
if isinstance(tags, str):
|
||||
tags = [tags]
|
||||
xmp = xmpdata
|
||||
except TypeError:
|
||||
...
|
||||
if None in tags:
|
||||
tags.remove(None)
|
||||
return {"width": width, "height": height, "tags": tags, "exifdata": exifdata, "xmp": xmp}
|
||||
@@ -219,18 +219,20 @@ def get_tags(sidecarfile: str) -> list[str]:
|
||||
strbuffer = sidecar.read()
|
||||
xmpdata = getxmp(strbuffer)
|
||||
tags = []
|
||||
if xmpdata.get("xmpmeta", False):
|
||||
if isinstance(xmpdata["xmpmeta"]["RDF"]["Description"], dict):
|
||||
if xmpdata["xmpmeta"]["RDF"]["Description"].get("subject", False):
|
||||
try:
|
||||
tags = xmpdata["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
|
||||
if isinstance(tags, str):
|
||||
tags = [tags]
|
||||
if xmpdata.get("xapmeta", False):
|
||||
if isinstance(xmpdata["xapmeta"]["RDF"]["Description"], dict):
|
||||
if xmpdata["xapmeta"]["RDF"]["Description"].get("subject", False):
|
||||
xmp = xmpdata
|
||||
except TypeError:
|
||||
...
|
||||
try:
|
||||
tags = xmpdata["xapmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"]
|
||||
if isinstance(tags, str):
|
||||
tags = [tags]
|
||||
xmp = xmpdata
|
||||
except TypeError:
|
||||
...
|
||||
if None in tags:
|
||||
tags.remove(None)
|
||||
return tags
|
||||
|
||||
Reference in New Issue
Block a user