Skip to content

Commit

Permalink
fix sofar
Browse files Browse the repository at this point in the history
  • Loading branch information
captn3m0 committed Apr 12, 2024
1 parent 39d84c2 commit f739a33
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/sofar.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,23 @@ def to_schema_org_music_event(event_info):
# events are assumed to be 2 hours long
endsAt = startsAt + datetime.timedelta(hours=2)

venue = ""
name = event_info['theme']['title'] + " Sofar concert at a "

categories = "/".join([x["name"] for x in event_info["venue"]["venueCategories"]])
if categories != "Other" :
venue = categories + " in "
name += categories + " in "
try:
venue += event_info["venue"]["neighborhood"]["title"]
except KeyError:
venue += event_info["city"]["title"]
name += event_info["venue"]["neighborhood"]["title"]
except Exception:
name += event_info["city"]["title"]

# Mapping the provided dictionary to schema.org format
music_event_schema = {
"url": f"{base_url}{event_info['id']}",
"startDate": startsAt.isoformat(),
"doorTime": guestsArriveAt.isoformat(),
"endDate": endsAt.isoformat(),
"location": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": "Bangalore",
"addressRegion": "KA",
"addressCountry": "IN",
"streetAddress": venue,
},
"keywords": event_info["venue"]["venueType"],
},
"name": name
}

return music_event_schema
Expand Down

0 comments on commit f739a33

Please sign in to comment.