merge-requests/30/head
Bob Mottram 2022-05-22 15:15:04 +01:00
parent abd4b64884
commit 6bf0798a8d
3 changed files with 6 additions and 5 deletions

View File

@ -194,7 +194,10 @@ def _geocoords_from_wego_link(url: str) -> (int, float, float):
return zoom, latitude, longitude
def geocoords_from_map_link(url: str, osm_domain: str) -> (int, float, float):
def geocoords_from_map_link(url: str,
osm_domain: str = 'openstreetmap.org') -> (int,
float,
float):
"""Returns geocoordinates from a map link url
"""
if osm_domain in url:

View File

@ -1283,9 +1283,8 @@ def _create_post_place_and_time(event_date: str, end_date: str,
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)
geocoords_from_map_link(location)
if latitude and longitude:
tags.append({
"@context": "https://www.w3.org/ns/activitystreams",

View File

@ -2187,9 +2187,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
set_map_preferences_url(base_dir, nickname, domain,
location_domain)
# remember the coordinates
osm_domain = 'openstreetmap.org'
map_zoom, map_latitude, map_longitude = \
geocoords_from_map_link(location_str, osm_domain)
geocoords_from_map_link(location_str)
if map_zoom and map_latitude and map_longitude:
set_map_preferences_coords(base_dir, nickname, domain,
map_latitude, map_longitude,