mirror of https://gitlab.com/bashrc2/epicyon
Check property types
parent
fc8885d679
commit
3d7cf796be
20
art.py
20
art.py
|
|
@ -67,7 +67,7 @@ def get_art_site_url(actor_json: {}) -> str:
|
||||||
get_attachment_property_value(property_value)
|
get_attachment_property_value(property_value)
|
||||||
if not prop_value_name:
|
if not prop_value_name:
|
||||||
continue
|
continue
|
||||||
art_text = remove_html(property_value[prop_value_name])
|
art_text: str = remove_html(property_value[prop_value_name])
|
||||||
if not string_contains(art_text, art_sites):
|
if not string_contains(art_text, art_sites):
|
||||||
continue
|
continue
|
||||||
if not resembles_url(art_text):
|
if not resembles_url(art_text):
|
||||||
|
|
@ -87,16 +87,18 @@ def set_art_site_url(actor_json: {}, art_site_url: str) -> None:
|
||||||
actor_json['attachment']: list[dict] = []
|
actor_json['attachment']: list[dict] = []
|
||||||
|
|
||||||
# remove any existing value
|
# remove any existing value
|
||||||
property_found = None
|
property_found: dict = None
|
||||||
for property_value in actor_json['attachment']:
|
for property_value in actor_json['attachment']:
|
||||||
if not isinstance(property_value, dict):
|
if not isinstance(property_value, dict):
|
||||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||||
continue
|
continue
|
||||||
name_value = None
|
name_value: str = None
|
||||||
if property_value.get('name'):
|
if property_value.get('name'):
|
||||||
name_value = property_value['name'].lower()
|
if isinstance(property_value['name'], str):
|
||||||
|
name_value = property_value['name'].lower()
|
||||||
elif property_value.get('schema:name'):
|
elif property_value.get('schema:name'):
|
||||||
name_value = property_value['schema:name'].lower()
|
if isinstance(property_value['schema:name'], str):
|
||||||
|
name_value = property_value['schema:name'].lower()
|
||||||
if not name_value:
|
if not name_value:
|
||||||
continue
|
continue
|
||||||
if not property_value.get('type'):
|
if not property_value.get('type'):
|
||||||
|
|
@ -113,11 +115,13 @@ def set_art_site_url(actor_json: {}, art_site_url: str) -> None:
|
||||||
if not isinstance(property_value, dict):
|
if not isinstance(property_value, dict):
|
||||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||||
continue
|
continue
|
||||||
name_value = None
|
name_value: str = None
|
||||||
if property_value.get('name'):
|
if property_value.get('name'):
|
||||||
name_value = property_value['name']
|
if isinstance(property_value['name'], str):
|
||||||
|
name_value = property_value['name']
|
||||||
elif property_value.get('schema:name'):
|
elif property_value.get('schema:name'):
|
||||||
name_value = property_value['schema:name']
|
if isinstance(property_value['schema:name'], str):
|
||||||
|
name_value = property_value['schema:name']
|
||||||
if not name_value:
|
if not name_value:
|
||||||
continue
|
continue
|
||||||
if not property_value.get('type'):
|
if not property_value.get('type'):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue