diff --git a/agenda/accommodation.py b/agenda/accommodation.py index 3ce4b9e..f5b7e83 100644 --- a/agenda/accommodation.py +++ b/agenda/accommodation.py @@ -13,8 +13,7 @@ def get_events(filepath: str) -> list[Event]: date=item["from"], end_date=item["to"], name="accommodation", - title="π§³" - + ( + title=( f'{item["location"]} Airbnb' if item.get("operator") == "airbnb" else item["name"] diff --git a/agenda/birthday.py b/agenda/birthday.py index fdebd5d..e5f28a8 100644 --- a/agenda/birthday.py +++ b/agenda/birthday.py @@ -42,7 +42,7 @@ def get_birthdays(from_date: date, filepath: str) -> list[Event]: Event( date=bday.replace(year=bday.year + offset), name="birthday", - title=f'π {entity["label"]} ({display_age})', + title=f'{entity["label"]} ({display_age})', ) ) diff --git a/agenda/calendar.py b/agenda/calendar.py index 4d2a8d8..56ef6c8 100644 --- a/agenda/calendar.py +++ b/agenda/calendar.py @@ -36,7 +36,7 @@ def build_events(events: list[Event]) -> list[dict[str, typing.Any]]: assert e.title and e.end_date item = { "allDay": True, - "title": e.display_title, + "title": e.title_with_emoji, "start": e.as_date.isoformat(), "end": (e.end_as_date + one_day).isoformat(), "url": e.url, @@ -66,7 +66,7 @@ def build_events(events: list[Event]) -> list[dict[str, typing.Any]]: end = (e.end_as_date if e.end_date else e.as_date) + one_day item = { "allDay": not e.has_time, - "title": e.display_title, + "title": e.title_with_emoji, "start": e.date.isoformat(), "end": end.isoformat(), } diff --git a/agenda/conference.py b/agenda/conference.py index 8452642..14d5b31 100644 --- a/agenda/conference.py +++ b/agenda/conference.py @@ -51,7 +51,7 @@ def get_list(filepath: str) -> list[Event]: name="conference", date=conf.start, end_date=conf.end, - title=f"π€ {conf.display_name}", + title=conf.display_name, url=conf.url, going=conf.going, ) diff --git a/agenda/data.py b/agenda/data.py index 7c3f04c..c7268e6 100644 --- a/agenda/data.py +++ b/agenda/data.py @@ -363,7 +363,7 @@ async def get_data( if not dt: continue - rocket_name = f'π{launch["rocket"]}: {launch["mission_name"] or "[no mission]"}' + rocket_name = f'{launch["rocket"]}: {launch["mission_name"] or "[no mission]"}' e = Event(name="rocket", date=dt, title=rocket_name) events.append(e) diff --git a/agenda/meetup.py b/agenda/meetup.py index ab80d16..3330e52 100644 --- a/agenda/meetup.py +++ b/agenda/meetup.py @@ -21,7 +21,7 @@ def get_events(data_dir: str) -> list[Event]: date=start, end_date=end, name="meetup", - title="π₯" + item_event["title"], + title=item_event["title"], url=item_event["eventUrl"], ) events.append(e) diff --git a/agenda/types.py b/agenda/types.py index 84cbc59..7b8ae3c 100644 --- a/agenda/types.py +++ b/agenda/types.py @@ -93,6 +93,23 @@ class Holiday: date: datetime.date +emojis = { + "market": "π§Ί", + "us_presidential_election": "π³οΈπΊπΈ", + "bus_route_closure": "πβ", + "meetup": "π₯", + "dinner": "π·", + "party": "π·", + "ba_voucher": "βοΈ", + "accommodation": "π¨", # alternative: 𧳠+ "flight": "βοΈ", + "conference": "π€", + "rocket": "π", + "birthday": "π", + "waste_schedule": "ποΈ", +} + + @dataclass class Event: """Event.""" @@ -182,3 +199,17 @@ class Event: def display_title(self) -> str: """Name for display.""" return self.title or self.name + + @property + def emoji(self) -> str | None: + """Emoji.""" + return emojis.get(self.name) + + @property + def title_with_emoji(self) -> str | None: + """Title with optional emoji at the start.""" + title = self.title or self.name + if title is None: + return None + emoji = self.emoji + return f"{emoji} {title}" if emoji else title diff --git a/agenda/waste_schedule.py b/agenda/waste_schedule.py index 3e3f253..6f0349b 100644 --- a/agenda/waste_schedule.py +++ b/agenda/waste_schedule.py @@ -95,7 +95,7 @@ def parse(root: lxml.html.HtmlElement) -> list[Event]: Event( name="waste_schedule", date=uk_time(d, time(6, 30)), - title="ποΈ Backwell: " + ", ".join(services), + title="Backwell: " + ", ".join(services), ) for d, services in by_date.items() ] @@ -208,6 +208,6 @@ async def get_bristol_gov_uk( by_date[d].append(service) return [ - Event(name="waste_schedule", date=d, title="ποΈ Bristol: " + ", ".join(services)) + Event(name="waste_schedule", date=d, title="Bristol: " + ", ".join(services)) for d, services in by_date.items() ] diff --git a/templates/index.html b/templates/index.html index 818ec90..399331d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -184,7 +184,7 @@