mirror of https://gitlab.com/bashrc2/epicyon
Include geocoords within Place tags if relevant
parent
49235ac71f
commit
abd4b64884
15
posts.py
15
posts.py
|
@ -93,6 +93,7 @@ from linked_data_sig import generate_json_signature
|
||||||
from petnames import resolve_petnames
|
from petnames import resolve_petnames
|
||||||
from video import convert_video_to_note
|
from video import convert_video_to_note
|
||||||
from context import get_individual_post_context
|
from context import get_individual_post_context
|
||||||
|
from maps import geocoords_from_map_link
|
||||||
|
|
||||||
|
|
||||||
def is_moderator(base_dir: str, nickname: str) -> bool:
|
def is_moderator(base_dir: str, nickname: str) -> bool:
|
||||||
|
@ -1280,6 +1281,20 @@ def _create_post_place_and_time(event_date: str, end_date: str,
|
||||||
"endTime": end_date_str
|
"endTime": end_date_str
|
||||||
})
|
})
|
||||||
if location and not event_uuid:
|
if location and not event_uuid:
|
||||||
|
latitude = longitude = None
|
||||||
|
if '://' in location:
|
||||||
|
osm_domain = 'openstreetmap.org'
|
||||||
|
_, latitude, longitude = \
|
||||||
|
geocoords_from_map_link(location, osm_domain)
|
||||||
|
if latitude and longitude:
|
||||||
|
tags.append({
|
||||||
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
"type": "Place",
|
||||||
|
"name": location,
|
||||||
|
"latitude": latitude,
|
||||||
|
"longitude": longitude
|
||||||
|
})
|
||||||
|
else:
|
||||||
tags.append({
|
tags.append({
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Place",
|
"type": "Place",
|
||||||
|
|
Loading…
Reference in New Issue